check constraint validation takes access exclusive locks

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
Subject: check constraint validation takes access exclusive locks
Date: 2012-02-26 14:04:28
Message-ID: CAFj8pRC7g8i4omZeJc1F77JmgyFwBwSx17BJ2VnU-_woLGGNyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-02-26 14:12:43 Re: Command Triggers, patch v11
Previous Message Peter Eisentraut 2012-02-26 13:41:32 Re: Triggers with DO functionality