From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: support fast default for domain with constraints |
Date: | 2025-03-05 03:13:40 |
Message-ID: | 229413.1741144420@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
jian he <jian(dot)universality(at)gmail(dot)com> writes:
> Thanks to commit aaaf9449ec6be62cb0d30ed3588dc384f56274bf[1],
> ExprState.escontext (ErrorSaveContext) was added, and ExecEvalConstraintNotNull,
> ExecEvalConstraintCheck were changed to use errsave instead of hard error.
> Now we can use it to evaluate CoerceToDomain in a soft error way, that
> is what this patch intended to do.
This patch appears to summarily throw away a couple of
backwards-compatibility concerns that the previous round
took care to preserve:
* not throwing an error if the default would fail the domain
constraints, but the table is empty so there is no need to
instantiate the default.
* not assuming that the domain constraints are immutable.
Now it's fair to question how important the second point is
considering that we mostly treat domain constraints as immutable
elsewhere. But I think the first point has actual practical uses
--- for example, if you want to set things up so that inserts must
specify that column explicitly. So I don't think it's okay to
discard that behavior.
Maybe we need a regression test case demonstrating that that
behavior exists, to discourage people from breaking it ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-03-05 03:35:26 | Monitoring gaps in XLogWalRcvWrite() for the WAL receiver |
Previous Message | jian he | 2025-03-05 02:56:42 | support fast default for domain with constraints |