hi.

should UPDATE statement need to verify that the domain value is satisfied with
invalid domain constraints?
Álvaro Herrera already mentioned this in [1], but I just want to confirm it.

drop table if exists dt1;
drop domain if exists d1;
create domain d1 as int;
create table dt1(i int, c d1);
insert into dt1 values(1,2);
alter domain d1 add constraint cc check(value <> 2) not valid;

update dt1 set i = i + 1;
update dt1 set c = c;
update dt1 set i = i + 1, c = c;
update dt1 set i = i + 1, c = c::d1;

Should the four statements above result in an error?
This only happens with UPDATE, since INSERT will check with domain
invalid constraints.

this ``update dt1 set i = i + 1, c = 2;``
do return error, which is expected.

[1]: https://postgr.es/m/202508140957.4daktvyr7xiw@alvherre.pgsql


Reply via email to