refactor AlterDomainAddConstraint (alter domain add constraint)
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-12-06T08:31:38Z
Lists: pgsql-hackers
Attachments
- v1-0001-refactor-AlterDomainAddConstraint.patch (text/x-patch) patch v1-0001
hi. attached patch refactor AlterDomainAddConstraint * change the error message: alter domain d_int add constraint nn not null no inherit; from ERROR: NOT NULL constraints cannot be marked NO INHERIT to ERROR: DOMAIN with NOT NULL constraints cannot be marked NO INHERIT basically processCASbits from processCASbits($3, @3, "NOT NULL") processCASbits($5, @5, "CHECK") to processCASbits($3, @3, "DOMAIN with NOT NULL") processCASbits($5, @5, "DOMAIN with CHECK") * error out check constraint no inherit with domain. so the following should fail. alter domain d_int add constraint cc check(value > 1) no inherit; --should fail * delete code in AlterDomainAddConstraint, since it will be unreachable. * alter domain d_int add constraint cc2 check(value > 11) not deferrable initially immediate not valid; "not deferrable", "initially immediate" cannot error out at the moment. maybe we can just document it in create_domain.sgml? * some failed regress test, similar to thread (Pass ParseState as down to utility functions) you may also see the patch draft commit message.
Commits
-
Fix bogus grammar for a CREATE CONSTRAINT TRIGGER error
- 87251e114967 19 (unreleased) cited
-
Remove dead code
- 7407b2d48cf3 18.0 landed