Re: assertions and constraint triggers - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: assertions and constraint triggers
Date
Msg-id 1281541664.26522.6.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: assertions and constraint triggers  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
List pgsql-hackers
On ons, 2010-08-11 at 13:23 +0300, Marko Tiikkaja wrote:
> But you'd have to somehow make the constraints to be checked 
> with true serializability, and that part of the original suggestion 
> seemed to be completely missing.  Not sure how hard that would be
> though.

I don't think somehow running the constraint checks at a different
transaction isolation level than the rest of the transaction is
sensible.  I imagine the solution would look similar to how foreign keys
do it: take a lock on the rows that are required for constraint
satisfaction.  For general assertions, this would require predicate
locking.  But also notice that for the (SELECT count(*) FROM tbl) = N
case, this is the same as a table lock.  I don't think there is any
magic around it.



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Regression tests versus the buildfarm environment
Next
From: Tom Lane
Date:
Subject: Re: Regression tests versus the buildfarm environment