Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcecf41b

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 missingtab-complete support for TABLESPACE I already sent earlier. New in thisversion of the patch is a small adaption of the tab-complete code tosupport the adjusted SAVEPOINT-Syntax commited by Tom, as well ascompletion 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 (byaddingAGGREGATE,CONVERSATION,DOMAIN,FUNCTION,LANGUAGE,OPERATOR,SEQUENCE,TABLESPACEand 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-completelist(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 hadcompletion support!) - i know it's depreciated but we have ABORT andothers 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 parent1b5e014 commitcecf41b

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/2004:29:32 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.111 2004/08/2019: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+
#defineQuery_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
#defineQuery_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+
#defineQuery_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
staticconstchar*constsql_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
staticconstchar*constbackslash_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
staticconstchar*constlist_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+
elseif (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+
staticconstchar*constlist_ALTERGEN[]=
664+
{"OWNER TO","RENAME TO",NULL};
665+
666+
COMPLETE_WITH_LIST(list_ALTERGEN);
667+
}
640668

641669
/* ALTER DATABASE <name> */
642670
elseif (pg_strcasecmp(prev3_wd,"ALTER")==0&&
@@ -649,17 +677,47 @@ psql_completion(char *text, int start, int end)
649677
}
650678
/* ALTER INDEX <name> */
651679
elseif (pg_strcasecmp(prev3_wd,"ALTER")==0&&
652-
pg_strcasecmp(prev2_wd,"INDEX")==0)
653-
{
654-
staticconstchar*constlist_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+
staticconstchar*constlist_ALTERINDEX[]=
683+
{"SET TABLESPACE","OWNER TO","RENAME TO",NULL};
684+
685+
COMPLETE_WITH_LIST(list_ALTERINDEX);
686+
}
687+
688+
/* ALTER DOMAIN <name> */
689+
elseif (pg_strcasecmp(prev3_wd,"ALTER")==0&&
690+
pg_strcasecmp(prev2_wd,"DOMAIN")==0)
691+
{
692+
staticconstchar*constlist_ALTERDOMAIN[]=
693+
{"ADD","DROP","OWNER TO","SET",NULL};
659694

695+
COMPLETE_WITH_LIST(list_ALTERDOMAIN);
696+
}
697+
/* ALTER DOMAIN <sth> DROP */
698+
elseif (pg_strcasecmp(prev4_wd,"ALTER")==0&&
699+
pg_strcasecmp(prev3_wd,"DOMAIN")==0&&
700+
pg_strcasecmp(prev_wd,"DROP")==0)
701+
{
702+
staticconstchar*constlist_ALTERDOMAIN2[]=
703+
{"CONSTRAINT","DEFAULT","NOT NULL","OWNER TO",NULL};
704+
705+
COMPLETE_WITH_LIST(list_ALTERDOMAIN2);
706+
}
707+
/* ALTER DOMAIN <sth> SET */
708+
elseif (pg_strcasecmp(prev4_wd,"ALTER")==0&&
709+
pg_strcasecmp(prev3_wd,"DOMAIN")==0&&
710+
pg_strcasecmp(prev_wd,"SET")==0)
711+
{
712+
staticconstchar*constlist_ALTERDOMAIN3[]=
713+
{"DEFAULT","NOT NULL",NULL};
714+
715+
COMPLETE_WITH_LIST(list_ALTERDOMAIN3);
716+
}
660717
/* ALTER TRIGGER <name>, add ON */
661718
elseif (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 ONor OWNER
676734
*/
677735
elseif (pg_strcasecmp(prev3_wd,"ALTER")==0&&
678736
pg_strcasecmp(prev2_wd,"TABLE")==0)
679737
{
680738
staticconstchar*constlist_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+
elseif (pg_strcasecmp(prev3_wd,"TABLE")==0&&
765+
pg_strcasecmp(prev_wd,"CLUSTER")==0)
766+
COMPLETE_WITH_CONST("ON");
767+
elseif (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+
elseif (pg_strcasecmp(prev3_wd,"TABLE")==0&&
776+
pg_strcasecmp(prev_wd,"SET")==0)
777+
{
778+
staticconstchar*constlist_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+
elseif (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+
elseif (pg_strcasecmp(prev4_wd,"TABLE")==0&&
790+
pg_strcasecmp(prev2_wd,"SET")==0&&
791+
pg_strcasecmp(prev_wd,"WITHOUT")==0)
792+
{
793+
staticconstchar*constlist_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+
elseif (pg_strcasecmp(prev3_wd,"ALTER")==0&&
800+
pg_strcasecmp(prev2_wd,"TABLESPACE")==0)
801+
{
802+
staticconstchar*constlist_ALTERTSPC[]=
803+
{"RENAME TO","OWNER TO",NULL};
804+
805+
COMPLETE_WITH_LIST(list_ALTERTSPC);
806+
}
807+
/* complete ALTER TYPE <foo> with OWNER TO */
808+
elseif (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
elseif (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+
elseif (pg_strcasecmp(prev_wd,"RELEASE")==0 )
854+
COMPLETE_WITH_CONST("SAVEPOINT");
747855
/* ROLLBACK*/
748856
elseif (pg_strcasecmp(prev_wd,"ROLLBACK")==0 )
749857
{
750858
staticconstchar*constlist_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-
elseif (pg_strcasecmp(prev_wd,"CLUSTER")==0)
864+
/* If the previous word is CLUSTER and not without produce list
865+
* of indexes. */
866+
elseif (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-
elseif (pg_strcasecmp(prev2_wd,"CLUSTER")==0)
870+
elseif (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
staticconstchar*constlist_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
staticconstchar*constlist_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
elseif ((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
elseif (pg_strcasecmp(prev_wd,"SCHEMA")==0)
10131125
COMPLETE_WITH_QUERY(Query_for_list_of_schemas);
1126+
elseif (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
elseif (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+
elseif (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
elseif (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
elseif ((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
elseif ((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-
elseif (pg_strcasecmp(prev4_wd,"TRANSACTION")==0&&
1289+
elseif ((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-
elseif (pg_strcasecmp(prev4_wd,"TRANSACTION")==0&&
1300+
elseif ((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
elseif ((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
staticconstchar*constmy_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
elseif (strcmp(prev_wd,"\\da")==0)
13081434
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_aggregates,NULL);
1435+
elseif (strcmp(prev_wd,"\\db")==0)
1436+
COMPLETE_WITH_QUERY(Query_for_list_of_tablespaces);
13091437
elseif (strcmp(prev_wd,"\\dD")==0)
13101438
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_domains,NULL);
13111439
elseif (strcmp(prev_wd,"\\df")==0||strcmp(prev_wd,"\\df+")==0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp