From a74a5f59137c778450bafcc1b7de505a7a4a9204 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 24 Oct 2011 13:22:59 +0200 Subject: [PATCH] Make TABLE tab complation in psql include all relations Not just tables, since views also work fine with the TABLE command. --- src/bin/psql/tab-complete.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index aba9b4b5aa..bb0fa09f3e 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -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);