You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is primarily done by evaluating CoerceToDomain with soft error support.
If CoerceToDomain is evaluated as false in ATExecAddColumn, the defval node's
value cannot be cast to the domain type. However, in some cases like when the
table is empty, we cannot explicitly error out in ATExecAddColumn (Phase 2).
For example, imagine add a new domain column to empty x, and the column domain
specification is ``CHECK(value > 10) DEFAULT 8``. In such situations, the ALTER
TABLE ADD COLUMN should be success.
Thanks to commit aaaf944[1],
ExprState.escontext (ErrorSaveContext) was added, and ExecEvalConstraintNotNull,
ExecEvalConstraintCheck were changed to use errsave instead of hard error. Now
we can evaluate CoerceToDomain in a soft error way.
However we do table rewrite for domain with volatile check constraints.
discussion: https://postgr.es/m/CACJufxE_+iZBR1i49k_AHigppPwLTJi6km8NOsC7FWvKdEmmXg@mail.gmail.com
[1]: https://git.postgresql.org/cgit/postgresql.git/commit/?id=aaaf9449ec6be62cb0d30ed3588dc384f56274bf
0 commit comments