Jeroen Ruigrok/asmodai <asmodai@wxs.nl> writes:
> Because what I can imagine, and please correct me if I miss something in
> my thought pattern, you have a small gap between dropping a constraint
> and adding the new one allowing the possibility of missing checks.
If you're concerned about concurrent transactions, you should do the
change like this:
begin;alter table drop constraint ...;alter table add constraint ...;commit;
which leaves no window for missed checks. (The first ALTER will take
out an exclusive lock on the table, which will be held till end of
transaction.)
regards, tom lane