Re: constraint modification on todo list - Mailing list pgsql-hackers

From Tom Lane
Subject Re: constraint modification on todo list
Date
Msg-id 3128.1063056162@sss.pgh.pa.us
Whole thread Raw
In response to Re: constraint modification on todo list  (Jeroen Ruigrok/asmodai <asmodai@wxs.nl>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: constraint modification on todo list
Next
From: Tom Lane
Date:
Subject: Re: pgsql in shared lib