Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e90c54

Browse files
author
Neil Conway
committed
Another tweak for tab completion of CREATE TEMP. Instead of only
completing CREATE { TEMP | TEMPORARY } TABLE, we should also suggest VIEW and SEQUENCE. Per Greg Sabino Mullane.
1 parent 16fb5da commit 8e90c54

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/bin/psql/tab-complete.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.163 2007/04/26 18:10:28 neilc Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.164 2007/04/26 22:25:56 neilc Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -1107,11 +1107,16 @@ psql_completion(char *text, int start, int end)
11071107
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
11081108

11091109
/* CREATE TABLE */
1110-
/* Complete CREATE TEMP/TEMPORARY with "TABLE" */
1110+
/* Complete "CREATE TEMP/TEMPORARY" with the possible temp objects */
11111111
else if (pg_strcasecmp(prev2_wd, "CREATE") == 0 &&
11121112
(pg_strcasecmp(prev_wd, "TEMP") == 0 ||
11131113
pg_strcasecmp(prev_wd, "TEMPORARY") == 0))
1114-
COMPLETE_WITH_CONST("TABLE");
1114+
{
1115+
static const char *const list_TEMP[] =
1116+
{ "SEQUENCE", "TABLE", "VIEW", NULL };
1117+
1118+
COMPLETE_WITH_LIST(list_TEMP);
1119+
}
11151120

11161121
/* CREATE TABLESPACE */
11171122
else if (pg_strcasecmp(prev3_wd, "CREATE") == 0 &&

0 commit comments

Comments
 (0)