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

Commit9270778

Browse files
committed
Improve psql tab completion for various DROP commands
The following improvements are done:- Handling of RESTRICT/CASCADE for DROP OWNED, matviews and policies.- Handling of DROP TRANSFORMThis is a continuation of the work done in0cd6d3b andf44ceb4.Author: Ken KatoReviewed-by: Asif RehmanDiscussion:https://postgr.es/m/0fafb73f3a0c6bcec817a25ca9d5a853@oss.nttdata.com
1 parent538724f commit9270778

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,12 +3322,16 @@ psql_completion(const char *text, int start, int end)
33223322
COMPLETE_WITH("VIEW");
33233323
elseif (Matches("DROP","MATERIALIZED","VIEW"))
33243324
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews,NULL);
3325+
elseif (Matches("DROP","MATERIALIZED","VIEW",MatchAny))
3326+
COMPLETE_WITH("CASCADE","RESTRICT");
33253327

33263328
/* DROP OWNED BY */
33273329
elseif (Matches("DROP","OWNED"))
33283330
COMPLETE_WITH("BY");
33293331
elseif (Matches("DROP","OWNED","BY"))
33303332
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
3333+
elseif (Matches("DROP","OWNED","BY",MatchAny))
3334+
COMPLETE_WITH("CASCADE","RESTRICT");
33313335

33323336
/* DROP TEXT SEARCH */
33333337
elseif (Matches("DROP","TEXT","SEARCH"))
@@ -3368,6 +3372,8 @@ psql_completion(const char *text, int start, int end)
33683372
completion_info_charp=prev2_wd;
33693373
COMPLETE_WITH_QUERY(Query_for_list_of_tables_for_policy);
33703374
}
3375+
elseif (Matches("DROP","POLICY",MatchAny,"ON",MatchAny))
3376+
COMPLETE_WITH("CASCADE","RESTRICT");
33713377

33723378
/* DROP RULE */
33733379
elseif (Matches("DROP","RULE",MatchAny))
@@ -3380,6 +3386,21 @@ psql_completion(const char *text, int start, int end)
33803386
elseif (Matches("DROP","RULE",MatchAny,"ON",MatchAny))
33813387
COMPLETE_WITH("CASCADE","RESTRICT");
33823388

3389+
/* DROP TRANSFORM */
3390+
elseif (Matches("DROP","TRANSFORM"))
3391+
COMPLETE_WITH("FOR");
3392+
elseif (Matches("DROP","TRANSFORM","FOR"))
3393+
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_datatypes,NULL);
3394+
elseif (Matches("DROP","TRANSFORM","FOR",MatchAny))
3395+
COMPLETE_WITH("LANGUAGE");
3396+
elseif (Matches("DROP","TRANSFORM","FOR",MatchAny,"LANGUAGE"))
3397+
{
3398+
completion_info_charp=prev2_wd;
3399+
COMPLETE_WITH_QUERY(Query_for_list_of_languages);
3400+
}
3401+
elseif (Matches("DROP","TRANSFORM","FOR",MatchAny,"LANGUAGE",MatchAny))
3402+
COMPLETE_WITH("CASCADE","RESTRICT");
3403+
33833404
/* EXECUTE */
33843405
elseif (Matches("EXECUTE"))
33853406
COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp