Re: support fast default for domain with constraints
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-05-19T07:05:04Z
Lists: pgsql-hackers
Attachments
- v5-0002-add-function-DomainHaveVolatileConstraints.patch (text/x-patch) patch v5-0002
- v5-0003-fast-default-for-domain-with-constraints.patch (text/x-patch) patch v5-0003
- v5-0001-soft-error-variant-of-ExecPrepareExpr-ExecInitExp.patch (text/x-patch) patch v5-0001
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.
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