Re: Checking number of entries - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Checking number of entries
Date
Msg-id Pine.LNX.4.21.0010061140040.30739-100000@fnord.io.com
Whole thread Raw
In response to Checking number of entries  (oberpwd@anubis.network.com (Wade D. Oberpriller))
List pgsql-general
>IIRC,SQL92 recommends to handle this case
>as ASSERTIONS rather than as CONSTRAINTS.
Yeah, that was my first thought was to build
them and try to make the constraint look like
an assertion.  That doesn't get around locking
though.

>The implementation would be quite different from
>that of (current) column constraints.
>I've been suspicious if it could be implemented
>properly and effectively.
>For example,are there any discussions about
>locking needed to guarantee the consistency ?
Not yet, and I'm not sure the backend even provides
the necessary hooks right now (I haven't looked).
For example, what rows get locked when you are
checking a count(*) constraint (apart from grabbing
a lock on all the tables involved).  How do you
prevent someone from inserting a new row that matches
a criteria until your check is finished (locking
non-existant rows).  It's much easier in the
alter table case since I already have a table lock
there. :(

I want to do the table/columns that a constraint
references anyway, so that we can move towards
having drops that cascade/restrict.


pgsql-general by date:

Previous
From: Frank Joerdens
Date:
Subject: Re: Trying to use PGSql with PHP
Next
From: "Jack"
Date:
Subject: PostgreSQL 7.0