psql_table.patch

text/x-patch

Filename: psql_table.patch
Type: text/x-patch
Part: 0
Message: Re: TABLE tab completion

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/bin/psql/tab-complete.c 6 0
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 4f7df36..0e2f524 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2648,6 +2648,12 @@ psql_completion(char *text, int start, int end)
 	else if (pg_strcasecmp(prev_wd, "START") == 0)
 		COMPLETE_WITH_CONST("TRANSACTION");
 
+/* TABLE */
+	else if (pg_strcasecmp(prev_wd, "TABLE") == 0 &&
+			 pg_strcasecmp(prev2_wd, "TABLE") == 0)
+		/* must not match DROP TABLE etc */
+		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);