refactor AlterDomainAddConstraint (alter domain add constraint)

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: refactor AlterDomainAddConstraint (alter domain add constraint)
Date: 2024-12-06 08:31:38
Message-ID: CACJufxHitd5LGLBSSAPShhtDWxT0ViVKTHinkYW-skBX93TcpA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Attachment Content-Type Size
v1-0001-refactor-AlterDomainAddConstraint.patch text/x-patch 9.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tofig Aliev 2024-12-06 08:38:35 Fix tiny memory leaks
Previous Message Amit Langote 2024-12-06 08:26:49 Re: generic plans and "initial" pruning