| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | AT_AddColumn container/composite type over constrained domain should table rewrite |
| Date: | 2026-03-16 04:05:32 |
| Message-ID: | CACJufxHECPvePeoLADvNM=PKY+qeveXd=DtPOaqL6VsjKr+TfA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi.
CREATE DOMAIN domain7 as int CHECK(random(min=>1::int, max=>11) < value);
CREATE TABLE test_add_domain_col(a int);
INSERT INTO test_add_domain_col VALUES (1), (2);
ALTER TABLE test_add_domain_col ADD COLUMN x domain7[] default '{5}';
The above ALTER TABLE sometimes fails and sometimes not fail, but
there no table rewrite.
IMHO, We should do table rewrites for container types whose element
types include constrained domains.
Note, this issue exists before
https://git.postgresql.org/cgit/postgresql.git/commit/?id=a0b6ef29a51818a4073a5f390ed10ef6453d5c11
The attached POC fix is for HEAD only (after
a0b6ef29a51818a4073a5f390ed10ef6453d5c11)
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-table-rewrite-for-container-type-include-constrained-domain.patch | text/x-patch | 9.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-03-16 04:37:02 | Re: Skipping schema changes in publication |
| Previous Message | Corey Huinker | 2026-03-16 03:48:47 | Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions |