From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> |
Cc: | Jan Wieck <JanWieck(at)Yahoo(dot)com>, Luis Sousa <llsousa(at)ualg(dot)pt>, Richard Huxton <dev(at)archonet(dot)com>, Filipe Bonjour <fbonjour(at)urbanet(dot)ch>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Can arrays reference primary keys in CREATE TABLE? |
Date: | 2003-05-23 15:17:32 |
Message-ID: | 20030523081208.D69228-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Fri, 23 May 2003, Oleg Bartunov wrote:
> On Thu, 22 May 2003, Jan Wieck wrote:
>
> > Luis Sousa wrote:
> > > Jan Wieck wrote:
> > >> You used a trigger to check something, but unless you have a full set of
> > >> said triggers and they do the locking as well, you do not have
> > >> referential integrity.
> > >>
> > >>
> > >> Jan
> > >>
> > >>
> > > I guess you are right.
> > > I'll have to write a trigger for UPDATE or DELETE. How can I do the lock
> > > only on that record ?
> >
> > That exactly is the problem with arrays here. You can't index an array
> > in a way so that you can effectively select all rows who's array
> > contains a particular value. Your trigger can only select all of them
>
> there is contrib/intarray which could be used for indexed access to
> array of integers. In principle, it should be not difficult to
> generalize this module to support many types.
Yeah, that should get around locking all the rows. It will still mean
that deadlocks are even more likely to occur with such tables than with
the normal constraint conditions however (locking the row containing one
element we're looking for effectively locks for all of those values).
As a side note, there are some other issues with making the constraint
work for non-no action constraints. I'm not sure if SET NULL or SET
DEFAULT can be meaningfully done at all with the current array support,
nor exactly what CASCADE means for delete (does it remove the array
element or the entire row).
From | Date | Subject | |
---|---|---|---|
Next Message | Mukta Telang | 2003-05-23 15:39:23 | faster output from php and postgres |
Previous Message | Johann Thoyer | 2003-05-23 15:12:21 | pg_connect |