8000 Fix tab completion for ALTER ... TABLESPACE ... OWNED BY. · home201448/postgres@130d94a · GitHub
[go: up one dir, main page]

Skip to content

Commit 130d94a

Browse files
committed
Fix tab completion for ALTER ... TABLESPACE ... OWNED BY.
Previously the completion used the wrong word to match 'BY'. This was introduced brokenly, in b2de2a. While at it, also add completion of IN TABLESPACE ... OWNED BY and fix comments referencing nonexistent syntax. Reported-By: Michael Paquier Author: Michael Paquier and Andres Freund Discussion: CAB7nPqSHDdSwsJqX0d2XzjqOHr==HdWiubCi4L=Zs7YFTUne8w@mail.gmail.com Backpatch: 9.4, like the commit introducing the bug
1 parent bbbd807 commit 130d94a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/bin/psql/tab-complete.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ psql_completion(const char *text, int start, int end)
10251025

10261026
COMPLETE_WITH_LIST(list_ALTER);
10271027
}
1028-
/* ALTER TABLE,INDEX,MATERIALIZED VIEW xxx ALL IN TABLESPACE xxx */
1028+
/* ALTER TABLE,INDEX,MATERIALIZED VIEW ALL IN TABLESPACE xxx */
10291029
else if (pg_strcasecmp(prev4_wd, "ALL") == 0 &&
10301030
pg_strcasecmp(prev3_wd, "IN") == 0 &&
10311031
pg_strcasecmp(prev2_wd, "TABLESPACE") == 0)
@@ -1035,15 +1035,23 @@ psql_completion(const char *text, int start, int end)
10351035

10361036
COMPLETE_WITH_LIST(list_ALTERALLINTSPC);
10371037
}
1038-
/* ALTER TABLE,INDEX,MATERIALIZED VIEW xxx ALL IN TABLESPACE xxx OWNED BY */
1038+
/* ALTER TABLE,INDEX,MATERIALIZED VIEW ALL IN TABLESPACE xxx OWNED BY */
10391039
else if (pg_strcasecmp(prev6_wd, "ALL") == 0 &&
10401040
pg_strcasecmp(prev5_wd, "IN") == 0 &&
10411041
pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
10421042
pg_strcasecmp(prev2_wd, "OWNED") == 0 &&
1043-
pg_strcasecmp(prev4_wd, "BY") == 0)
1043+
pg_strcasecmp(prev_wd, "BY") == 0)
10441044
{
10451045
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
10461046
}
1047+
/* ALTER TABLE,INDEX,MATERIALIZED VIEW ALL IN TABLESPACE xxx OWNED BY xxx */
1048+
else if (pg_strcasecmp(prev6_wd, "IN") == 0 &&
1049+
pg_strcasecmp(prev5_wd, "TABLESPACE") == 0 &&
1050+
pg_strcasecmp(prev3_wd, "OWNED") == 0 &&
1051+
pg_strcasecmp(prev2_wd, "BY") == 0)
1052+
{
1053+
COMPLETE_WITH_CONST("SET TABLESPACE");
1054+
}
10471055
/* ALTER AGGREGATE,FUNCTION <name> */
10481056
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
10491057
(pg_strcasecmp(prev2_wd, "AGGREGATE") == 0 ||

0 commit comments

Comments
 (0)
0