Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a3f4c8e

Browse files
committed
Fix tab completion for "ALTER SYSTEM SET variable ...".
It wouldn't complete "TO" after the variable name, which is certainly minor enough. But since we do complete "TO" after "SET variable ...", and since this case used to work pre-9.6, I think this is a bug. Also, fix the query used to collect the variable names; whoever last touched it evidently didn't understand how the pieces are supposed to fit together. It accidentally worked anyway, because readline ignores irrelevant completions, but it was randomly unlike the ones around it, and could be a source of actual bugs if someone copied it as a prototype for another query.
1 parent 8350aae commit a3f4c8e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/bin/psql/tab-complete.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,9 @@ static const SchemaQuery Query_for_list_of_matviews = {
628628
#define Query_for_list_of_alter_system_set_vars \
629629
"SELECT name FROM "\
630630
" (SELECT pg_catalog.lower(name) AS name FROM pg_catalog.pg_settings "\
631-
" WHERE context != 'internal') ss "\
632-
" WHERE substring(name,1,%d)='%s'"\
633-
" UNION ALL SELECT 'all' ss"
631+
" WHERE context != 'internal' "\
632+
" UNION ALL SELECT 'all') ss "\
633+
" WHERE substring(name,1,%d)='%s'"
634634

635635
#define Query_for_list_of_set_vars \
636636
"SELECT name FROM "\
@@ -1572,9 +1572,10 @@ psql_completion(const char *text, int start, int end)
15721572
/* ALTER SYSTEM SET, RESET, RESET ALL */
15731573
else if (Matches2("ALTER", "SYSTEM"))
15741574
COMPLETE_WITH_LIST2("SET", "RESET");
1575-
/* ALTER SYSTEM SET|RESET <name> */
15761575
else if (Matches3("ALTER", "SYSTEM", "SET|RESET"))
15771576
COMPLETE_WITH_QUERY(Query_for_list_of_alter_system_set_vars);
1577+
else if (Matches4("ALTER", "SYSTEM", "SET", MatchAny))
1578+
COMPLETE_WITH_CONST("TO");
15781579
/* ALTER VIEW <name> */
15791580
else if (Matches3("ALTER", "VIEW", MatchAny))
15801581
COMPLETE_WITH_LIST4("ALTER COLUMN", "OWNER TO", "RENAME TO",

0 commit comments

Comments
 (0)