diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index b3bfe050b18..d1076449921 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -2185,8 +2185,14 @@ match_previous_words(int pattern_id, /* BEGIN GEN_TABCOMPLETE */ /* CREATE */ - /* complete with something you can create */ - else if (TailMatches("CREATE")) + + /* + * Complete with something you can create. If CREATE is a privilege name, + * leave it to the GRANT/REVOKE rules below. + */ + else if (TailMatches("CREATE") && + !TailMatches("GRANT|REVOKE", "CREATE") && + !TailMatches("REVOKE", "GRANT", "OPTION", "FOR", "CREATE")) { /* only some object types can be created as part of CREATE SCHEMA */ if (HeadMatches("CREATE", "SCHEMA"))