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 CACJufxG-NQmEutUnsA3q1RV1iT5MWpaj3MSOH4aVo_UNZUA86g@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, Sep 1, 2025 at 2:27 PM jian he <jian.universality@gmail.com> wrote:
>
> summary of the attached v7.
> v7-0001, v7-00002: preparatory patch.
> v7-0003 adds fast default support for ALTER TABLE ADD COLUMN when the domain has
> non-volatile constraints.
> A table rewrite is still required for domains with volatile constraints.
>
> v7-0004 skip table rewrite (table scan only) for ALTER TABLE ADD
> COLUMN with domains has volatile constraints.
>

Hi.

rebase, and further simplified.

maybe we could perform a table scan for ALTER TABLE ADD COLUMN when the domain
has volatile constraints like v7-0004, avoiding a table rewrite.
However, this approach
feels inelegant, so I do not plan to pursue it.

So, the fast default now applies to domains with non-volatile constraint
expressions only.

Regarding the prior discussion about empty table behavior. This patch is
consistent with the master: not throwing an error if the default would fail the
domain constraints.



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

Attachment

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: unnecessary executor overheads around seqscans
Next
From: Richard Guo
Date:
Subject: Re: Optimize IS DISTINCT FROM with non-nullable inputs