Re: Checking number of entries

From: Stephan Szabo <sszabo(at)io(dot)com>
To: inoue(at)tpf(dot)co(dot)jp
Cc: pjw(at)rhyme(dot)co(dot)au, pgsql-general(at)postgresql(dot)org
Subject: Re: Checking number of entries
Date: 2000-10-06 16:50:30
Message-ID: Pine.LNX.4.21.0010061140040.30739-100000@fnord.io.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Mercer 2000-10-06 16:53:28 Re: postgres via shell scripts
Previous Message Vilson farias 2000-10-06 16:50:27 Need help : Weird referencial Integrity triggers