Re: support fast default for domain with constraints
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-01-26T07:52:16Z
Lists: pgsql-hackers
Attachments
- v8-0002-add-function-DomainHaveVolatileConstraints.patch (text/x-patch) patch v8-0002
- v8-0001-Enable-soft-error-handling-in-ExecPrepareExpr-and-ExecInitExpr.patch (text/x-patch) patch v8-0001
- v8-0003-fast-default-for-domain-with-constraints.patch (text/x-patch) patch v8-0003
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/
Commits
-
Enable fast default for domains with non-volatile constraints
- a0b6ef29a518 19 (unreleased) landed
-
Extend DomainHasConstraints() to optionally check constraint volatility
- 487cf2cbd2f5 19 (unreleased) landed
-
Restrict virtual columns to use built-in functions and types
- 0cd69b3d7ef3 18.0 cited
-
Replace EEOP_DONE with special steps for return/no return
- 8dd7c7cd0a26 18.0 cited
-
Add soft error handling to some expression nodes
- aaaf9449ec6b 17.0 cited