]> granicus.if.org Git - postgresql/commitdiff
Make TABLE tab complation in psql include all relations
authorMagnus Hagander <magnus@hagander.net>
Mon, 24 Oct 2011 11:22:59 +0000 (13:22 +0200)
committerMagnus Hagander <magnus@hagander.net>
Mon, 24 Oct 2011 11:22:59 +0000 (13:22 +0200)
Not just tables, since views also work fine with the
TABLE command.

src/bin/psql/tab-complete.c

index aba9b4b5aac597ff20b1ce428a8d42401ffd32e3..bb0fa09f3eaefb3d47d03da48724598cbc96595d 100644 (file)
@@ -2657,6 +2657,11 @@ psql_completion(char *text, int start, int end)
        else if (pg_strcasecmp(prev_wd, "START") == 0)
                COMPLETE_WITH_CONST("TRANSACTION");
 
+/* TABLE, but not TABLE embedded in other commands */
+       else if (pg_strcasecmp(prev_wd, "TABLE") == 0 &&
+                        prev2_wd[0] == '\0')
+               COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_relations, NULL);
+
 /* TRUNCATE */
        else if (pg_strcasecmp(prev_wd, "TRUNCATE") == 0)
                COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);