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

Commit816f105

Browse files
committed
psql: Add some completion support for CREATE TABLE .. AS
"AS" is added as a suggested keyword for CREATE TABLE for a few querypatterns, including the case where a list of columns is given inparenthesis.More queries can be now completed with the keywords supported forqueries in a CTAS, after:CREATE TABLE [TEMP|TEMPORARY|UNLOGGED] <name> [ (...) ] ASAuthor: Gilles DaroldReviewed-by: Jim JonesDiscussion:https://postgr.es/m/e462b251-99a7-4abc-aedc-214688742c80@darold.net
1 parent69c32b8 commit816f105

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,20 +3228,26 @@ psql_completion(const char *text, int start, int end)
32283228
/* Limited completion support for partition bound specification */
32293229
elseif (TailMatches("PARTITION","OF",MatchAny))
32303230
COMPLETE_WITH("FOR VALUES","DEFAULT");
3231-
/* Complete CREATE TABLE <name> with '(', OF or PARTITION OF */
3231+
/* Complete CREATE TABLE <name> with '(',AS,OF or PARTITION OF */
32323232
elseif (TailMatches("CREATE","TABLE",MatchAny)||
32333233
TailMatches("CREATE","TEMP|TEMPORARY|UNLOGGED","TABLE",MatchAny))
3234-
COMPLETE_WITH("(","OF","PARTITION OF");
3234+
COMPLETE_WITH("(","AS","OF","PARTITION OF");
32353235
/* Complete CREATE TABLE <name> OF with list of composite types */
32363236
elseif (TailMatches("CREATE","TABLE",MatchAny,"OF")||
32373237
TailMatches("CREATE","TEMP|TEMPORARY|UNLOGGED","TABLE",MatchAny,"OF"))
32383238
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_composite_datatypes);
3239+
/* Complete CREATE TABLE <name> [ (...) ] AS with list of keywords */
3240+
elseif (TailMatches("CREATE","TABLE",MatchAny,"AS")||
3241+
TailMatches("CREATE","TABLE",MatchAny,"(*)","AS")||
3242+
TailMatches("CREATE","TEMP|TEMPORARY|UNLOGGED","TABLE",MatchAny,"AS")||
3243+
TailMatches("CREATE","TEMP|TEMPORARY|UNLOGGED","TABLE",MatchAny,"(*)","AS"))
3244+
COMPLETE_WITH("EXECUTE","SELECT","TABLE","VALUES","WITH");
32393245
/* Complete CREATE TABLE name (...) with supported options */
32403246
elseif (TailMatches("CREATE","TABLE",MatchAny,"(*)")||
32413247
TailMatches("CREATE","UNLOGGED","TABLE",MatchAny,"(*)"))
3242-
COMPLETE_WITH("INHERITS (","PARTITION BY","USING","TABLESPACE","WITH (");
3248+
COMPLETE_WITH("AS","INHERITS (","PARTITION BY","USING","TABLESPACE","WITH (");
32433249
elseif (TailMatches("CREATE","TEMP|TEMPORARY","TABLE",MatchAny,"(*)"))
3244-
COMPLETE_WITH("INHERITS (","ON COMMIT","PARTITION BY",
3250+
COMPLETE_WITH("AS","INHERITS (","ON COMMIT","PARTITION BY",
32453251
"TABLESPACE","WITH (");
32463252
/* Complete CREATE TABLE (...) USING with table access methods */
32473253
elseif (TailMatches("CREATE","TABLE",MatchAny,"(*)","USING")||

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp