]> granicus.if.org Git - postgresql/commitdiff
Fix psql's tab completion for ALTER DATABASE ... SET TABLESPACE.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 20 Sep 2018 21:16:06 +0000 (17:16 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 20 Sep 2018 21:16:06 +0000 (17:16 -0400)
We have the infrastructure to offer a list of tablespace names, but
it wasn't being used here; instead you got "FROM", "CURRENT", and "TO"
which aren't actually legal in this syntax.

Dagfinn Ilmari MannsÃ¥ker, reviewed by Arthur Zakirov

Discussion: https://postgr.es/m/d8jo9djvm7h.fsf@dalvik.ping.uio.no

src/bin/psql/tab-complete.c

index 7549b401922cad18abfdcc7f5785d8fb35b60af2..3d627c10a188565490a6ba7bd095e29e63dc0d57 100644 (file)
@@ -1588,6 +1588,10 @@ psql_completion(const char *text, int start, int end)
                                                        "IS_TEMPLATE", "ALLOW_CONNECTIONS",
                                                        "CONNECTION LIMIT");
 
+       /* ALTER DATABASE <name> SET TABLESPACE */
+       else if (Matches5("ALTER", "DATABASE", MatchAny, "SET", "TABLESPACE"))
+               COMPLETE_WITH_QUERY(Query_for_list_of_tablespaces);
+
        /* ALTER EVENT TRIGGER */
        else if (Matches3("ALTER", "EVENT", "TRIGGER"))
                COMPLETE_WITH_QUERY(Query_for_list_of_event_triggers);