Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a74a5f5

Browse files
committed
Make TABLE tab complation in psql include all relations
Not just tables, since views also work fine with the TABLE command.
1 parent 8140c1b commit a74a5f5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/bin/psql/tab-complete.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,6 +2657,11 @@ psql_completion(char *text, int start, int end)
26572657
else if (pg_strcasecmp(prev_wd, "START") == 0)
26582658
COMPLETE_WITH_CONST("TRANSACTION");
26592659

2660+
/* TABLE, but not TABLE embedded in other commands */
2661+
else if (pg_strcasecmp(prev_wd, "TABLE") == 0 &&
2662+
prev2_wd[0] == '\0')
2663+
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_relations, NULL);
2664+
26602665
/* TRUNCATE */
26612666
else if (pg_strcasecmp(prev_wd, "TRUNCATE") == 0)
26622667
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);

0 commit comments

Comments
 (0)