AT_AddColumn container/composite type over constrained domain should table rewrite - Mailing list pgsql-hackers

From jian he
Subject AT_AddColumn container/composite type over constrained domain should table rewrite
Date
Msg-id CACJufxHECPvePeoLADvNM=PKY+qeveXd=DtPOaqL6VsjKr+TfA@mail.gmail.com
Whole thread
List 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)



--
jian
https://www.enterprisedb.com/

Attachment

pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions
Next
From: shveta malik
Date:
Subject: Re: Skipping schema changes in publication