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

Commitd0066b9

Browse files
committed
Tab completion for CREATE TABLESPACE arguments. Patch by Joachim Wieland.
1 parent745bb96 commitd0066b9

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

‎src/bin/psql/tab-complete.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.116 2004/09/22 04:25:16 neilc Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.117 2004/11/02 16:10:05 petere Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -488,7 +488,8 @@ psql_completion(char *text, int start, int end)
488488
char*prev_wd,
489489
*prev2_wd,
490490
*prev3_wd,
491-
*prev4_wd;
491+
*prev4_wd,
492+
*prev5_wd;
492493

493494
staticconstchar*constsql_commands[]= {
494495
"ABORT","ALTER","ANALYZE","BEGIN","CHECKPOINT","CLOSE","CLUSTER","COMMENT",
@@ -637,6 +638,7 @@ psql_completion(char *text, int start, int end)
637638
prev2_wd=previous_word(start,1);
638639
prev3_wd=previous_word(start,2);
639640
prev4_wd=previous_word(start,3);
641+
prev5_wd=previous_word(start,4);
640642

641643
/* If a backslash command was started, continue */
642644
if (text[0]=='\\')
@@ -766,14 +768,14 @@ psql_completion(char *text, int start, int end)
766768
{
767769
staticconstchar*constlist_ALTERSCHEMA2[]=
768770
{"MINVALUE","MAXVALUE","CYCLE",NULL};
769-
771+
770772
COMPLETE_WITH_LIST(list_ALTERSCHEMA2);
771773
}
772774
/* ALTER TRIGGER <name>, add ON */
773775
elseif (pg_strcasecmp(prev3_wd,"ALTER")==0&&
774776
pg_strcasecmp(prev2_wd,"TRIGGER")==0)
775777
COMPLETE_WITH_CONST("ON");
776-
778+
777779
elseif (pg_strcasecmp(prev4_wd,"ALTER")==0&&
778780
pg_strcasecmp(prev3_wd,"TRIGGER")==0)
779781
{
@@ -1004,7 +1006,7 @@ psql_completion(char *text, int start, int end)
10041006
{
10051007
staticconstchar*constlist_FROMTO[]=
10061008
{"FROM","TO",NULL};
1007-
1009+
10081010
COMPLETE_WITH_LIST(list_FROMTO);
10091011
}
10101012
/* If we have COPY|BINARY <sth> FROM|TO, complete with filename */
@@ -1112,6 +1114,23 @@ psql_completion(char *text, int start, int end)
11121114
pg_strcasecmp(prev_wd,"TEMP")==0)
11131115
COMPLETE_WITH_CONST("TABLE");
11141116

1117+
/* CREATE TABLESPACE */
1118+
elseif (pg_strcasecmp(prev3_wd,"CREATE")==0&&
1119+
pg_strcasecmp(prev2_wd,"TABLESPACE")==0)
1120+
{
1121+
staticconstchar*constlist_CREATETABLESPACE[]=
1122+
{"OWNER","LOCATION",NULL};
1123+
1124+
COMPLETE_WITH_LIST(list_CREATETABLESPACE);
1125+
}
1126+
/* Complete CREATE TABLESPACE name OWNER name with "LOCATION" */
1127+
elseif (pg_strcasecmp(prev5_wd,"CREATE")==0&&
1128+
pg_strcasecmp(prev4_wd,"TABLESPACE")==0&&
1129+
pg_strcasecmp(prev2_wd,"OWNER")==0)
1130+
{
1131+
COMPLETE_WITH_CONST("LOCATION");
1132+
}
1133+
11151134
/* CREATE TRIGGER */
11161135
/* is on the agenda . . . */
11171136

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp