Add tab-completion for CREATE FOREIGN TABLE.
authorFujii Masao <fujii@postgresql.org>
Sat, 15 Jan 2022 02:22:24 +0000 (11:22 +0900)
committerFujii Masao <fujii@postgresql.org>
Sat, 15 Jan 2022 02:22:24 +0000 (11:22 +0900)
Unlike CREATE TABLE, CREATE FOREIGN TABLE is not allowed inside
CREATE SCHEMA, so Matches() is used instead of TailMatches() for
the tab-completion.

Author: Tang <tanghy.fnst@fujitsu.com>
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/OS0PR01MB61137E96E0551278782D11CDFB519@OS0PR01MB6113.jpnprd01.prod.outlook.com

src/bin/psql/tab-complete.c

index 39be6f556a81bcd7c6a65414df58c4d46ff45c08..71f1a5c00d967dedafdf502b7a63e1654461369b 100644 (file)
@@ -2636,6 +2636,10 @@ psql_completion(const char *text, int start, int end)
    else if (Matches("CREATE", "FOREIGN", "DATA", "WRAPPER", MatchAny))
        COMPLETE_WITH("HANDLER", "VALIDATOR", "OPTIONS");
 
+   /* CREATE FOREIGN TABLE */
+   else if (Matches("CREATE", "FOREIGN", "TABLE", MatchAny))
+       COMPLETE_WITH("(", "PARTITION OF");
+
    /* CREATE INDEX --- is allowed inside CREATE SCHEMA, so use TailMatches */
    /* First off we complete CREATE UNIQUE with "INDEX" */
    else if (TailMatches("CREATE", "UNIQUE"))