| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
|---|---|
| To: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: support fast default for domain with constraints |
| Date: | 2026-03-10 17:18:42 |
| Message-ID: | bba5e471-d122-45e2-8c8b-6421804c2043@dunslane.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2026-01-26 Mo 2:52 AM, jian he wrote:
> On Mon, Sep 1, 2025 at 2:27 PM jian he <jian(dot)universality(at)gmail(dot)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.
>
>
>
here's an updated patch set.
main changes:
. renamed DomainHaveVolatileConstraints renamed to
DomainHasVolatileConstraints, improved the comments and code structure
. squashed two commits into one, as there's only one user for the
soft-error functions
. rename ExecPrepareExprExtended to ExecPrepareExprWithContext and
ExecInitExprExtended to ExecInitExprWithContext, with improved comments.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
| Attachment | Content-Type | Size |
|---|---|---|
| v9-0001-Add-DomainHasVolatileConstraints-to-check-constraint.patch | text/x-patch | 3.1 KB |
| v9-0002-Enable-fast-default-for-domains-with-non-volatile-co.patch | text/x-patch | 15.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Frédéric Yhuel | 2026-03-10 17:24:18 | n_dead_tup could be way off just after a vacuum |
| Previous Message | Andres Freund | 2026-03-10 17:11:09 | Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record |