check constraint validation takes access exclusive locks - Mailing list pgsql-hackers

From Pavel Stehule
Subject check constraint validation takes access exclusive locks
Date
Msg-id CAFj8pRC7g8i4omZeJc1F77JmgyFwBwSx17BJ2VnU-_woLGGNyA@mail.gmail.com
Whole thread Raw
Responses Re: check constraint validation takes access exclusive locks  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-hackers
Hello

I rechecked Depesz's article -
http://www.depesz.com/2011/07/01/waiting-for-9-2-not-valid-checks/

The behave of current HEAD is different than behave described in article.

"alter table a validate constraint a_a_check" needs a access exclusive
locks and blocks table modification - I tested inserts.

Is it expected behave.

session one:

postgres=# create table a(a int);
CREATE TABLE
postgres=# alter table a add check (a > 0) not valid;
ALTER TABLE
postgres=# begin;
BEGIN
postgres=# alter table a validate constraint a_a_check;
ALTER TABLE

session two:

postgres=# update a set a = 100; -- it waits to commit in session one

Regards

Pavel Stehule


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Triggers with DO functionality
Next
From: Dimitri Fontaine
Date:
Subject: Re: Command Triggers, patch v11