From a7c3b02b29fed1ce4c17795c6c2c9cb7477337ba Mon Sep 17 00:00:00 2001 From: Baji Shaik Date: Sun, 4 Oct 2026 11:07:28 -0500 Subject: [PATCH] psql: Add tab completion for CHECK constraint modifiers After ALTER TABLE t ADD [CONSTRAINT c] CHECK (*), psql now suggests NOT ENFORCED, NOT VALID, and NO INHERIT. NOT ENFORCED is a new PG19 feature (commit 342051d73b3) that previously had no tab-completion discoverability. --- src/bin/psql/tab-complete.in.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index b3bfe050b18..b9a659026de 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -2849,6 +2849,10 @@ match_previous_words(int pattern_id, set_completion_reference(prev7_wd); COMPLETE_WITH_SCHEMA_QUERY(Query_for_unique_index_of_table); } + /* ALTER TABLE xxx ADD [CONSTRAINT yyy] CHECK (...) constraint options */ + else if (Matches("ALTER", "TABLE", MatchAny, "ADD", "CHECK", "(*)") || + Matches("ALTER", "TABLE", MatchAny, "ADD", "CONSTRAINT", MatchAny, "CHECK", "(*)")) + COMPLETE_WITH("NOT ENFORCED", "NOT VALID", "NO INHERIT"); /* ALTER TABLE xxx ENABLE */ else if (Matches("ALTER", "TABLE", MatchAny, "ENABLE")) COMPLETE_WITH("ALWAYS", "REPLICA", "ROW LEVEL SECURITY", "RULE", -- 2.54.0 (Apple Git-157)