Re: support fast default for domain with constraints - Mailing list pgsql-hackers

From jian he
Subject Re: support fast default for domain with constraints
Date
Msg-id CACJufxGNCw51aeVxXOtgzgbE9J710e91umNzH-56rG5tmtK8mw@mail.gmail.com
Whole thread Raw
In response to Re: support fast default for domain with constraints  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On Mon, Mar 24, 2025 at 7:14 PM jian he <jian.universality@gmail.com> wrote:
>
> v4-0003 table with empty rows aligned with master behavior.
> also will do table rewrite if the new column is domain with volatile
> check constraints,
> so less surprising behavior.

I found out that my v4-0003 is wrong.

For example, the following ALTER TABLE ADD COLUMN should not fail.
CREATE DOMAIN domain5 AS int check(value > 10) default 8;
CREATE TABLE t3(a int);
ALTER TABLE t3 ADD COLUMN b domain5 default 1; --ok, table rewrite

I also reduced the bloated tests.
summary of the behavior that is different from master:
if domain constraint is not volatile *and* domain's default expression satisfy
constraint's condition then no need table rewrite.

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Make wal_receiver_timeout configurable per subscription
Next
From: Amit Kapila
Date:
Subject: Re: POC: enable logical decoding when wal_level = 'replica' without a server restart