8000 Fix tab completion of ALTER FUNCTION/PROCEDURE/ROUTINE ... SET SCHEMA. · postgres/postgres@c54b888 · GitHub
[go: up one dir, main page]

Skip to content

Commit c54b888

Browse files
committed
Fix tab completion of ALTER FUNCTION/PROCEDURE/ROUTINE ... SET SCHEMA.
The ALTER DATABASE|FUNCTION|PROCEDURE|ROLE|ROUTINE|USER ... SET <name> case in psql tab completion failed to exclude <name> = "SCHEMA", which caused ALTER FUNCTION|PROCEDURE|ROUTINE ... SET SCHEMA to complete with "FROM CURRENT" and "TO", which won't work. Fix that, so that those cases now complete with the list of schemas, like other ALTER ... SET SCHEMA commands. Noticed while testing the recent patch to improve tab completion for ALTER FUNCTION/PROCEDURE/ROUTINE, but this is not directly related to that patch. Rather, this is a long-standing bug, so back-patch to all supported branches. Discussion: https://postgr.es/m/CALDaNm0s7GQmkLP_mx5Cvk=UzYMnjhPmXBxU8DsHEunFbC5sTg@mail.gmail.com
1 parent 0b496bc commit c54b888

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bin/psql/tab-complete.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3528,11 +3528,12 @@ psql_completion(const char *text, int start, int end)
35283528
COMPLETE_WITH_CONST("TO");
35293529

35303530
/*
3531-
* Complete ALTER DATABASE|FUNCTION||PROCEDURE|ROLE|ROUTINE|USER ... SET
3531+
* Complete ALTER DATABASE|FUNCTION|PROCEDURE|ROLE|ROUTINE|USER ... SET
35323532
* <name>
35333533
*/
35343534
else if (HeadMatches2("ALTER", "DATABASE|FUNCTION|PROCEDURE|ROLE|ROUTINE|USER") &&
3535-
TailMatches2("SET", MatchAny))
3535+
TailMatches2("SET", MatchAny) &&
3536+
!TailMatches1("SCHEMA"))
35363537
COMPLETE_WITH_LIST2("FROM CURRENT", "TO");
35373538

35383539
/*

0 commit comments

Comments
 (0)
0