Skip to content

Commit cecf41b

Browse files
committed
Attached is the third version of my patch that adds/fixes several things
to/in the psql-tabcomplete code. This diff includes the still missing tab-complete support for TABLESPACE I already sent earlier. New in this version of the patch is a small adaption of the tab-complete code to support the adjusted SAVEPOINT-Syntax commited by Tom, as well as completion of the only half working (and I think only by accident) tabcomplete-suppport for "BEGIN [ TRANSACTION | WORK ]". below is a complete list of the things I have changed with this patch: *) add tablespace support for CREATE/DROP/ALTER and \db *) sync the list of possible commands following ALTER with the docs (by adding AGGREGATE,CONVERSATION,DOMAIN,FUNCTION,LANGUAGE,OPERATOR,SEQUENCE,TABLESPACE and TYPE) *) provide a list of valid users after "OWNER TO" *) tab-complete support for ALTER (AGGREGATE|CONVERSION|FUNCTION) *) basic tab-complete support for ALTER DOMAIN *) provide a list of suitable indexes following ALTER TABLE <sth> CLUSTER ON(?) *) add "CLUSTER ON" and "SET" to the ALTER TABLE <sth> - tab-complete list(fixes incorrect/wrong tab-complete with ALTER TABLE <sth> SET +<TAB> too) *) provide a list of possible indexes following ALTER TABLE <sth> CLUSTER ON *) provide list of possible commands(WITHOUT CLUSTER,WITHOUT OIDS, TABLESPACE) following ALTER TABLE <sth> SET *) sync "COMMENT ON" with docs by adding "CAST","CONVERSION","FUNCTION" *) add ABSOLUT to the list of possible commands after FETCH *) "END" was missing from the sql-commands overview (though it had completion support!) - i know it's depreciated but we have ABORT and others still in ... *) fixes small buglet with ALTER (TRIGGER|CLUSTER) ON autocomplete (CLUSTER ON +<TAB> would produce CLUSTER ON ON - same for TRIGGER ON) *) adapt to new SAVEPOINT syntax *) fix incomplete Support for BEGIN [ TRANSACTION | WORK ] Stefan Kaltenbrunn
1 parent 1b5e014 commit cecf41b

File tree

1 file changed

+162
-34
lines changed

1 file changed

+162
-34
lines changed

src/bin/psql/tab-complete.c

Lines changed: 162 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.110 2004/08/20 04:29:32 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.111 2004/08/20 19:24:59 momjian Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -328,6 +328,10 @@ static const SchemaQuery Query_for_list_of_views = {
328328
"SELECT pg_catalog.quote_ident(datname) FROM pg_catalog.pg_database "\
329329
" WHERE substring(pg_catalog.quote_ident(datname),1,%d)='%s'"
330330

331+
#define Query_for_list_of_tablespaces \
332+
"SELECT pg_catalog.quote_ident(spcname) FROM pg_catalog.pg_tablespace "\
333+
" WHERE substring(pg_catalog.quote_ident(spcname),1,%d)='%s'"
334+
331335
#define Query_for_list_of_encodings \
332336
" SELECT DISTINCT pg_catalog.pg_encoding_to_char(conforencoding) "\
333337
" FROM pg_catalog.pg_conversion "\
@@ -365,6 +369,15 @@ static const SchemaQuery Query_for_list_of_views = {
365369
" and pg_catalog.quote_ident(c2.relname)='%s'"\
366370
" and pg_catalog.pg_table_is_visible(c2.oid)"
367371

372+
/* the silly-looking length condition is just to eat up the current word */
373+
#define Query_for_index_of_table \
374+
"SELECT pg_catalog.quote_ident(c2.relname) "\
375+
" FROM pg_catalog.pg_class c1, pg_catalog.pg_class c2, pg_catalog.pg_index i"\
376+
" WHERE c1.oid=i.indrelid and i.indexrelid=c2.oid"\
377+
" and (%d = length('%s'))"\
378+
" and pg_catalog.quote_ident(c1.relname)='%s'"\
379+
" and pg_catalog.pg_table_is_visible(c2.oid)"
380+
368381
/*
369382
* This is a list of all "things" in Pgsql, which can show up after CREATE or
370383
* DROP; and there is also a query to get a list of them.
@@ -394,6 +407,7 @@ static const pgsql_thing_t words_after_create[] = {
394407
{"SCHEMA", Query_for_list_of_schemas},
395408
{"SEQUENCE", NULL, &Query_for_list_of_sequences},
396409
{"TABLE", NULL, &Query_for_list_of_tables},
410+
{"TABLESPACE", Query_for_list_of_tablespaces},
397411
{"TEMP", NULL, NULL}, /* for CREATE TEMP TABLE ... */
398412
{"TRIGGER", "SELECT pg_catalog.quote_ident(tgname) FROM pg_catalog.pg_trigger WHERE substring(pg_catalog.quote_ident(tgname),1,%d)='%s'"},
399413
{"TYPE", NULL, &Query_for_list_of_datatypes},
@@ -461,7 +475,7 @@ psql_completion(char *text, int start, int end)
461475

462476
static const char * const sql_commands[] = {
463477
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER", "COMMENT",
464-
"COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE", "DELETE", "DROP", "EXECUTE",
478+
"COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE", "DELETE", "DROP", "END", "EXECUTE",
465479
"EXPLAIN", "FETCH", "GRANT", "INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY",
466480
"PREPARE", "REINDEX", "RELEASE", "RESET", "REVOKE", "ROLLBACK", "SAVEPOINT",
467481
"SELECT", "SET", "SHOW", "START", "TRUNCATE", "UNLISTEN", "UPDATE", "VACUUM", NULL
@@ -575,9 +589,9 @@ psql_completion(char *text, int start, int end)
575589

576590
static const char * const backslash_commands[] = {
577591
"\\a", "\\connect", "\\C", "\\cd", "\\copy", "\\copyright",
578-
"\\d", "\\da", "\\dc", "\\dC", "\\dd", "\\dD", "\\df", "\\dg", "\\di",
579-
"\\dl", "\\dn", "\\do", "\\dp", "\\ds", "\\dS", "\\dt", "\\dT",
580-
"\\dv", "\\du",
592+
"\\d", "\\da", "\\db", "\\dc", "\\dC", "\\dd", "\\dD", "\\df",
593+
"\\dg", "\\di", "\\dl", "\\dn", "\\do", "\\dp", "\\ds", "\\dS",
594+
"\\dt", "\\dT", "\\dv", "\\du",
581595
"\\e", "\\echo", "\\encoding",
582596
"\\f", "\\g", "\\h", "\\help", "\\H", "\\i", "\\l",
583597
"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
@@ -632,11 +646,25 @@ psql_completion(char *text, int start, int end)
632646
pg_strcasecmp(prev3_wd, "TABLE") != 0)
633647
{
634648
static const char *const list_ALTER[] =
635-
{"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", "INDEX",
636-
NULL};
649+
{"AGGREGATE", "CONVERSATION", "DATABASE","DOMAIN", "FUNCTION",
650+
"GROUP", "LANGUAGE", "OPERATOR", "SCHEMA", "SEQUENCE", "TABLE",
651+
"TABLESPACE", "TRIGGER", "TYPE", "USER", NULL};
637652

638653
COMPLETE_WITH_LIST(list_ALTER);
639654
}
655+
656+
/* ALTER AGGREGATE,CONVERSION,FUNCTION,SCHEMA <name> */
657+
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
658+
(pg_strcasecmp(prev2_wd, "AGGREGATE") == 0 ||
659+
pg_strcasecmp(prev2_wd, "CONVERSION") == 0 ||
660+
pg_strcasecmp(prev2_wd, "FUNCTION") == 0 ||
661+
pg_strcasecmp(prev2_wd, "SCHEMA") == 0 ))
662+
{
663+
static const char *const list_ALTERGEN[] =
664+
{"OWNER TO", "RENAME TO", NULL};
665+
666+
COMPLETE_WITH_LIST(list_ALTERGEN);
667+
}
640668

641669
/* ALTER DATABASE <name> */
642670
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
@@ -649,17 +677,47 @@ psql_completion(char *text, int start, int end)
649677
}
650678
/* ALTER INDEX <name> */
651679
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
652-
pg_strcasecmp(prev2_wd, "INDEX") == 0)
653-
{
654-
static const char *const list_ALTERINDEX[] =
655-
{"SET TABLESPACE", "OWNER TO", "RENAME TO", NULL};
656-
657-
COMPLETE_WITH_LIST(list_ALTERINDEX);
658-
}
680+
pg_strcasecmp(prev2_wd, "INDEX") == 0)
681+
{
682+
static const char *const list_ALTERINDEX[] =
683+
{"SET TABLESPACE", "OWNER TO", "RENAME TO", NULL};
684+
685+
COMPLETE_WITH_LIST(list_ALTERINDEX);
686+
}
687+
688+
/* ALTER DOMAIN <name> */
689+
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
690+
pg_strcasecmp(prev2_wd, "DOMAIN") == 0)
691+
{
692+
static const char *const list_ALTERDOMAIN[] =
693+
{"ADD", "DROP", "OWNER TO", "SET", NULL};
659694

695+
COMPLETE_WITH_LIST(list_ALTERDOMAIN);
696+
}
697+
/* ALTER DOMAIN <sth> DROP */
698+
else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
699+
pg_strcasecmp(prev3_wd, "DOMAIN") == 0 &&
700+
pg_strcasecmp(prev_wd, "DROP") == 0)
701+
{
702+
static const char *const list_ALTERDOMAIN2[] =
703+
{"CONSTRAINT", "DEFAULT", "NOT NULL", "OWNER TO", NULL};
704+
705+
COMPLETE_WITH_LIST(list_ALTERDOMAIN2);
706+
}
707+
/* ALTER DOMAIN <sth> SET */
708+
else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
709+
pg_strcasecmp(prev3_wd, "DOMAIN") == 0 &&
710+
pg_strcasecmp(prev_wd, "SET") == 0)
711+
{
712+
static const char *const list_ALTERDOMAIN3[] =
713+
{"DEFAULT", "NOT NULL", NULL};
714+
715+
COMPLETE_WITH_LIST(list_ALTERDOMAIN3);
716+
}
660717
/* ALTER TRIGGER <name>, add ON */
661718
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
662-
pg_strcasecmp(prev2_wd, "TRIGGER") == 0)
719+
pg_strcasecmp(prev2_wd, "TRIGGER") == 0 &&
720+
pg_strcasecmp(prev_wd, "ON") != 0)
663721
COMPLETE_WITH_CONST("ON");
664722

665723
/*
@@ -672,13 +730,14 @@ psql_completion(char *text, int start, int end)
672730

673731
/*
674732
* If we detect ALTER TABLE <name>, suggest either ADD, DROP, ALTER,
675-
* RENAME, or OWNER
733+
* RENAME, CLUSTER ON or OWNER
676734
*/
677735
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
678736
pg_strcasecmp(prev2_wd, "TABLE") == 0)
679737
{
680738
static const char *const list_ALTER2[] =
681-
{"ADD", "ALTER", "DROP", "RENAME", "OWNER TO", NULL};
739+
{"ADD", "ALTER", "CLUSTER ON", "DROP", "RENAME", "OWNER TO",
740+
"SET", NULL};
682741

683742
COMPLETE_WITH_LIST(list_ALTER2);
684743
}
@@ -702,7 +761,53 @@ psql_completion(char *text, int start, int end)
702761
pg_strcasecmp(prev2_wd, "DROP") == 0 &&
703762
pg_strcasecmp(prev_wd, "COLUMN") == 0)
704763
COMPLETE_WITH_ATTR(prev3_wd);
764+
else if (pg_strcasecmp(prev3_wd, "TABLE") == 0 &&
765+
pg_strcasecmp(prev_wd, "CLUSTER") == 0)
766+
COMPLETE_WITH_CONST("ON");
767+
else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
768+
pg_strcasecmp(prev2_wd, "CLUSTER") == 0 &&
769+
pg_strcasecmp(prev_wd, "ON") == 0)
770+
{
771+
completion_info_charp = prev3_wd;
772+
COMPLETE_WITH_QUERY(Query_for_index_of_table);
773+
}
774+
/* If we have TABLE <sth> SET, provide WITHOUT or TABLESPACE */
775+
else if (pg_strcasecmp(prev3_wd, "TABLE") == 0 &&
776+
pg_strcasecmp(prev_wd, "SET") == 0)
777+
{
778+
static const char *const list_TABLESET[] =
779+
{"WITHOUT", "TABLESPACE", NULL};
780+
781+
COMPLETE_WITH_LIST(list_TABLESET);
782+
}
783+
/* If we have TABLE <sth> SET TABLESPACE provide a list of tablespaces*/
784+
else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
785+
pg_strcasecmp(prev2_wd, "SET") == 0 &&
786+
pg_strcasecmp(prev_wd, "TABLESPACE") == 0)
787+
COMPLETE_WITH_QUERY(Query_for_list_of_tablespaces);
788+
/* If we have TABLE <sth> SET WITHOUT provide CLUSTER or OIDS*/
789+
else if (pg_strcasecmp(prev4_wd, "TABLE") == 0 &&
790+
pg_strcasecmp(prev2_wd, "SET") == 0 &&
791+
pg_strcasecmp(prev_wd, "WITHOUT") == 0)
792+
{
793+
static const char *const list_TABLESET2[] =
794+
{"CLUSTER", "OIDS", NULL};
705795

796+
COMPLETE_WITH_LIST(list_TABLESET2);
797+
}
798+
/* we have ALTER TABLESPACE, so suggest RENAME TO, OWNER TO */
799+
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
800+
pg_strcasecmp(prev2_wd, "TABLESPACE") == 0)
801+
{
802+
static const char *const list_ALTERTSPC[] =
803+
{"RENAME TO", "OWNER TO", NULL};
804+
805+
COMPLETE_WITH_LIST(list_ALTERTSPC);
806+
}
807+
/* complete ALTER TYPE <foo> with OWNER TO */
808+
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
809+
pg_strcasecmp(prev2_wd, "TYPE") == 0)
810+
COMPLETE_WITH_CONST("OWNER TO");
706811
/* complete ALTER GROUP <foo> with ADD or DROP */
707812
else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
708813
pg_strcasecmp(prev2_wd, "GROUP") == 0)
@@ -744,20 +849,26 @@ psql_completion(char *text, int start, int end)
744849

745850
COMPLETE_WITH_LIST(list_TRANS);
746851
}
852+
/* RELEASE SAVEPOINT */
853+
else if ( pg_strcasecmp(prev_wd, "RELEASE") == 0 )
854+
COMPLETE_WITH_CONST("SAVEPOINT");
747855
/* ROLLBACK*/
748856
else if ( pg_strcasecmp(prev_wd, "ROLLBACK") == 0 )
749857
{
750858
static const char * const list_TRANS[] =
751-
{"WORK", "TRANSACTION", "TO", NULL};
859+
{"WORK", "TRANSACTION", "TO SAVEPOINT", NULL};
752860

753861
COMPLETE_WITH_LIST(list_TRANS);
754862
}
755863
/* CLUSTER */
756-
/* If the previous word is CLUSTER, produce list of indexes. */
757-
else if (pg_strcasecmp(prev_wd, "CLUSTER") == 0)
864+
/* If the previous word is CLUSTER and not without produce list
865+
* of indexes. */
866+
else if (pg_strcasecmp(prev_wd, "CLUSTER") == 0 &&
867+
pg_strcasecmp(prev2_wd, "WITHOUT") != 0)
758868
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
759869
/* If we have CLUSTER <sth>, then add "ON" */
760-
else if (pg_strcasecmp(prev2_wd, "CLUSTER") == 0)
870+
else if (pg_strcasecmp(prev2_wd, "CLUSTER") == 0 &&
871+
pg_strcasecmp(prev_wd,"ON") != 0)
761872
COMPLETE_WITH_CONST("ON");
762873

763874
/*
@@ -778,9 +889,9 @@ psql_completion(char *text, int start, int end)
778889
pg_strcasecmp(prev_wd, "ON") == 0)
779890
{
780891
static const char *const list_COMMENT[] =
781-
{"DATABASE", "INDEX", "RULE", "SCHEMA", "SEQUENCE", "TABLE",
782-
"TYPE", "VIEW", "COLUMN", "AGGREGATE", "FUNCTION", "OPERATOR",
783-
"TRIGGER", "CONSTRAINT", "DOMAIN", NULL};
892+
{"CAST", "CONVERSION", "DATABASE", "INDEX", "LANGUAGE", "RULE", "SCHEMA",
893+
"SEQUENCE", "TABLE", "TYPE", "VIEW", "COLUMN", "AGGREGATE", "FUNCTION",
894+
"OPERATOR", "TRIGGER", "CONSTRAINT", "DOMAIN", NULL};
784895

785896
COMPLETE_WITH_LIST(list_COMMENT);
786897
}
@@ -935,7 +1046,7 @@ psql_completion(char *text, int start, int end)
9351046
pg_strcasecmp(prev_wd, "MOVE") == 0)
9361047
{
9371048
static const char * const list_FETCH1[] =
938-
{"FORWARD", "BACKWARD", "RELATIVE", NULL};
1049+
{"ABSOLUT", "BACKWARD", "FORWARD", "RELATIVE", NULL};
9391050

9401051
COMPLETE_WITH_LIST(list_FETCH1);
9411052
}
@@ -996,7 +1107,8 @@ psql_completion(char *text, int start, int end)
9961107
" UNION SELECT 'DATABASE'"
9971108
" UNION SELECT 'FUNCTION'"
9981109
" UNION SELECT 'LANGUAGE'"
999-
" UNION SELECT 'SCHEMA'");
1110+
" UNION SELECT 'SCHEMA'"
1111+
" UNION SELECT 'TABLESPACE'");
10001112

10011113
/* Complete "GRANT/REVOKE * ON * " with "TO" */
10021114
else if ((pg_strcasecmp(prev4_wd, "GRANT") == 0 ||
@@ -1011,14 +1123,16 @@ psql_completion(char *text, int start, int end)
10111123
COMPLETE_WITH_QUERY(Query_for_list_of_languages);
10121124
else if (pg_strcasecmp(prev_wd, "SCHEMA") == 0)
10131125
COMPLETE_WITH_QUERY(Query_for_list_of_schemas);
1126+
else if (pg_strcasecmp(prev_wd, "TABLESPACE") == 0)
1127+
COMPLETE_WITH_QUERY(Query_for_list_of_tablespaces);
10141128
else
10151129
COMPLETE_WITH_CONST("TO");
10161130
}
10171131

10181132
/*
10191133
* TODO: to complete with user name we need prev5_wd -- wait for a
10201134
* more general solution there same for GRANT <sth> ON { DATABASE |
1021-
* FUNCTION | LANGUAGE | SCHEMA } xxx TO
1135+
* FUNCTION | LANGUAGE | SCHEMA | TABLESPACE } xxx TO
10221136
*/
10231137

10241138
/* INSERT */
@@ -1098,7 +1212,10 @@ psql_completion(char *text, int start, int end)
10981212
/* NOTIFY */
10991213
else if (pg_strcasecmp(prev_wd, "NOTIFY") == 0)
11001214
COMPLETE_WITH_QUERY("SELECT pg_catalog.quote_ident(relname) FROM pg_catalog.pg_listener WHERE substring(pg_catalog.quote_ident(relname),1,%d)='%s'");
1101-
1215+
/* OWNER TO - complete with available users*/
1216+
else if (pg_strcasecmp(prev2_wd, "OWNER") == 0 &&
1217+
pg_strcasecmp(prev_wd, "TO") == 0)
1218+
COMPLETE_WITH_QUERY(Query_for_list_of_users);
11021219
/* REINDEX */
11031220
else if (pg_strcasecmp(prev_wd, "REINDEX") == 0)
11041221
{
@@ -1147,16 +1264,20 @@ psql_completion(char *text, int start, int end)
11471264
COMPLETE_WITH_LIST(my_list);
11481265
}
11491266
else if ((pg_strcasecmp(prev3_wd, "SET") == 0
1267+
|| pg_strcasecmp(prev3_wd, "BEGIN") == 0
11501268
|| pg_strcasecmp(prev3_wd, "START") == 0
11511269
|| (pg_strcasecmp(prev4_wd, "CHARACTERISTICS") == 0
11521270
&& pg_strcasecmp(prev3_wd, "AS") == 0))
1153-
&& pg_strcasecmp(prev2_wd, "TRANSACTION") == 0
1271+
&& (pg_strcasecmp(prev2_wd, "TRANSACTION") == 0
1272+
|| pg_strcasecmp(prev2_wd, "WORK") == 0)
11541273
&& pg_strcasecmp(prev_wd, "ISOLATION") == 0)
11551274
COMPLETE_WITH_CONST("LEVEL");
11561275
else if ((pg_strcasecmp(prev4_wd, "SET") == 0
1276+
|| pg_strcasecmp(prev4_wd, "BEGIN") == 0
11571277
|| pg_strcasecmp(prev4_wd, "START") == 0
11581278
|| pg_strcasecmp(prev4_wd, "AS") == 0)
1159-
&& pg_strcasecmp(prev3_wd, "TRANSACTION") == 0
1279+
&& (pg_strcasecmp(prev3_wd, "TRANSACTION") == 0
1280+
|| pg_strcasecmp(prev3_wd, "WORK") == 0)
11601281
&& pg_strcasecmp(prev2_wd, "ISOLATION") == 0
11611282
&& pg_strcasecmp(prev_wd, "LEVEL") == 0)
11621283
{
@@ -1165,7 +1286,8 @@ psql_completion(char *text, int start, int end)
11651286

11661287
COMPLETE_WITH_LIST(my_list);
11671288
}
1168-
else if (pg_strcasecmp(prev4_wd, "TRANSACTION") == 0 &&
1289+
else if ((pg_strcasecmp(prev4_wd, "TRANSACTION") == 0 ||
1290+
pg_strcasecmp(prev4_wd, "WORK") == 0) &&
11691291
pg_strcasecmp(prev3_wd, "ISOLATION") == 0 &&
11701292
pg_strcasecmp(prev2_wd, "LEVEL") == 0 &&
11711293
pg_strcasecmp(prev_wd, "READ") == 0)
@@ -1175,14 +1297,18 @@ psql_completion(char *text, int start, int end)
11751297

11761298
COMPLETE_WITH_LIST(my_list);
11771299
}
1178-
else if (pg_strcasecmp(prev4_wd, "TRANSACTION") == 0 &&
1300+
else if ((pg_strcasecmp(prev4_wd, "TRANSACTION") == 0 ||
1301+
pg_strcasecmp(prev4_wd, "WORK") == 0) &&
11791302
pg_strcasecmp(prev3_wd, "ISOLATION") == 0 &&
11801303
pg_strcasecmp(prev2_wd, "LEVEL") == 0 &&
11811304
pg_strcasecmp(prev_wd, "REPEATABLE") == 0)
11821305
COMPLETE_WITH_CONST("READ");
11831306
else if ((pg_strcasecmp(prev3_wd, "SET") == 0 ||
1184-
pg_strcasecmp(prev3_wd, "AS") == 0) &&
1185-
pg_strcasecmp(prev2_wd, "TRANSACTION") == 0 &&
1307+
pg_strcasecmp(prev3_wd, "BEGIN") == 0 ||
1308+
pg_strcasecmp(prev3_wd, "START") == 0 ||
1309+
pg_strcasecmp(prev3_wd, "AS") == 0) &&
1310+
(pg_strcasecmp(prev2_wd, "TRANSACTION") == 0 ||
1311+
pg_strcasecmp(prev2_wd, "WORK") == 0) &&
11861312
pg_strcasecmp(prev_wd, "READ") == 0)
11871313
{
11881314
static const char * const my_list[] =
@@ -1306,6 +1432,8 @@ psql_completion(char *text, int start, int end)
13061432
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tisv, NULL);
13071433
else if (strcmp(prev_wd, "\\da") == 0)
13081434
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_aggregates, NULL);
1435+
else if (strcmp(prev_wd, "\\db") == 0)
1436+
COMPLETE_WITH_QUERY(Query_for_list_of_tablespaces);
13091437
else if (strcmp(prev_wd, "\\dD") == 0)
13101438
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_domains, NULL);
13111439
else if (strcmp(prev_wd, "\\df") == 0 || strcmp(prev_wd, "\\df+") == 0)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy