diff options
author | Dean Rasheed <dean.a.rasheed@gmail.com> | 2023-01-06 11:13:34 +0000 |
---|---|---|
committer | Dean Rasheed <dean.a.rasheed@gmail.com> | 2023-01-06 11:13:34 +0000 |
commit | 2ad4abedfeec23098c8066cf177216238224a60a (patch) | |
tree | 7ce4112db0ee94e6e7782763ea0015b4ab0eee20 /src | |
parent | ad38e2f89116435cffd56507380d94e4eb588789 (diff) | |
download | postgresql-2ad4abedfeec23098c8066cf177216238224a60a.tar.gz postgresql-2ad4abedfeec23098c8066cf177216238224a60a.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/tab-complete.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 9e8426b66b2..afd9669296d 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -3559,11 +3559,12 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH("TO"); /* - * Complete ALTER DATABASE|FUNCTION||PROCEDURE|ROLE|ROUTINE|USER ... SET + * Complete ALTER DATABASE|FUNCTION|PROCEDURE|ROLE|ROUTINE|USER ... SET * <name> */ else if (HeadMatches("ALTER", "DATABASE|FUNCTION|PROCEDURE|ROLE|ROUTINE|USER") && - TailMatches("SET", MatchAny)) + TailMatches("SET", MatchAny) && + !TailMatches("SCHEMA")) COMPLETE_WITH("FROM CURRENT", "TO"); /* |