Re: Can arrays reference primary keys in CREATE TABLE?

From: Luis Sousa <llsousa(at)ualg(dot)pt>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: 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-22 09:10:15
Message-ID: 3ECC93F7.60509@ualg.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jan Wieck wrote:

> Luis Sousa wrote:
>
>> Richard Huxton wrote:
>>
>>> On Friday 09 May 2003 10:21 pm, Filipe Bonjour wrote:
>>>
>>>
>>>> Hi,
>>>>
>>>> I'm a rather new SQL user, and I found interesting that you can
>>>> use "references" to make sure that a value inserted in a table is a
>>>> primary key from another table. Something like:
>>>
>>>
>>>
>>> Yep - referential integrity is vital.
>>>
>> I used a trigger to get referential integrity.
>> So, on update or insert, it fires the function that's going to read
>> the new array and check if really exists on the other table
>
>
> And what happens on UPDATE or DELETE to the primary key table?
>
> 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 ?

Luis Sousa

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2003-05-22 10:56:27 Re: Can arrays reference primary keys in CREATE TABLE?
Previous Message Prashanth - Kamath 2003-05-22 03:01:02 MIN function problem with Postgres7.3