Skip to content

Commit 14935f6

Browse files
reshkeCommitfest Bot
authored andcommitted
Add tab completion for ALTER TABLE xxx ALTER CONTRAINT ... ENFORCED/INHERIT
1 parent 5092aae commit 14935f6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,6 +2893,16 @@ match_previous_words(int pattern_id,
28932893
set_completion_reference(prev3_wd);
28942894
COMPLETE_WITH_SCHEMA_QUERY(Query_for_constraint_of_table);
28952895
}
2896+
/* if we have ALTER TABLE <sth> ALTER|DROP|RENAME CONSTRAINT <constraint>, provide [NOT] ENFORCED or [NO] INHERIT */
2897+
else if (Matches("ALTER", "TABLE", MatchAny, "ALTER|DROP|RENAME", "CONSTRAINT", MatchAny))
2898+
{
2899+
COMPLETE_WITH("ENFORCED", "NOT ENFORCED", "NO INHERIT", "INHERIT");
2900+
}
2901+
/* if we have ALTER TABLE <sth> ALTER|DROP|RENAME CONSTRAINT <constraint> NO, provide INHERIT */
2902+
else if (Matches("ALTER", "TABLE", MatchAny, "ALTER|DROP|RENAME", "CONSTRAINT", MatchAny, "NO"))
2903+
{
2904+
COMPLETE_WITH("INHERIT");
2905+
}
28962906
/* ALTER TABLE <sth> VALIDATE CONSTRAINT <non-validated constraint> */
28972907
else if (Matches("ALTER", "TABLE", MatchAny, "VALIDATE", "CONSTRAINT"))
28982908
{

0 commit comments

Comments
 (0)