Re: Checking number of entries

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: Stephan Szabo <sszabo(at)io(dot)com>
Cc: pjw(at)rhyme(dot)co(dot)au, pgsql-general(at)postgresql(dot)org
Subject: Re: Checking number of entries
Date: 2000-10-10 01:42:36
Message-ID: 39E2740C.C7E1DE33@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo wrote:

>
> >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).

Though it's not preferable, we should grab an exclusive
lock on all the tables for this case.

> How do you
> prevent someone from inserting a new row that matches
> a criteria until your check is finished (locking
> non-existant rows).

AFAIK,we have no standard way to lock non-existent rows
now. I don't know such cases other than unique constraints.
I'm not sure that the technique is applicable to all cases.
The current simplest and practical way is to grab an exclusive
lock on the target tables. However it's not preferable of cource.

Regards.

Hiroshi Inoue

In response to

Browse pgsql-general by date

  From Date Subject
Next Message bmccoy 2000-10-10 01:47:13 Re: distinct
Previous Message Alex Pilosov 2000-10-10 01:18:43 Re: Oracle to POSTGRESQL