aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2015-12-19 17:37:11 +0100
committerAndres Freund <andres@anarazel.de>2015-12-19 17:37:11 +0100
commit8ae22e7d36e349d7d8fd616fbf7f78cc03e301e0 (patch)
treeb70e7f7d267e401579c09550f70f920efea06aa3 /src
parent2c5b57ec7f0155eef7bd8d152e546ee96b2feb5e (diff)
downloadpostgresql-8ae22e7d36e349d7d8fd616fbf7f78cc03e301e0.tar.gz
postgresql-8ae22e7d36e349d7d8fd616fbf7f78cc03e301e0.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/tab-complete.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 303e23fa06d..b935810fe1e 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1001,7 +1001,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST(list_ALTER);
}
- /* ALTER TABLE,INDEX,MATERIALIZED VIEW xxx ALL IN TABLESPACE xxx */
+ /* ALTER TABLE,INDEX,MATERIALIZED VIEW ALL IN TABLESPACE xxx */
else if (pg_strcasecmp(prev4_wd, "ALL") == 0 &&
pg_strcasecmp(prev3_wd, "IN") == 0 &&
pg_strcasecmp(prev2_wd, "TABLESPACE") == 0)
@@ -1011,15 +1011,23 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH_LIST(list_ALTERALLINTSPC);
}
- /* ALTER TABLE,INDEX,MATERIALIZED VIEW xxx ALL IN TABLESPACE xxx OWNED BY */
+ /* ALTER TABLE,INDEX,MATERIALIZED VIEW ALL IN TABLESPACE xxx OWNED BY */
else if (pg_strcasecmp(prev6_wd, "ALL") == 0 &&
pg_strcasecmp(prev5_wd, "IN") == 0 &&
pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
pg_strcasecmp(prev2_wd, "OWNED") == 0 &&
- pg_strcasecmp(prev4_wd, "BY") == 0)
+ pg_strcasecmp(prev_wd, "BY") == 0)
{
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
}
+ /* ALTER TABLE,INDEX,MATERIALIZED VIEW ALL IN TABLESPACE xxx OWNED BY xxx */
+ else if (pg_strcasecmp(prev6_wd, "IN") == 0 &&
+ pg_strcasecmp(prev5_wd, "TABLESPACE") == 0 &&
+ pg_strcasecmp(prev3_wd, "OWNED") == 0 &&
+ pg_strcasecmp(prev2_wd, "BY") == 0)
+ {
+ COMPLETE_WITH_CONST("SET TABLESPACE");
+ }
/* ALTER AGGREGATE,FUNCTION <name> */
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
(pg_strcasecmp(prev2_wd, "AGGREGATE") == 0 ||