pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Luis Sousa <llsousa@ualg.pt>
To: Jan Wieck <JanWieck@Yahoo.com>
Cc: Richard Huxton <dev@archonet.com>
Cc: Filipe Bonjour <fbonjour@urbanet.ch>
Cc: pgsql-sql@postgresql.org
Subject: Re: Can arrays reference primary keys in CREATE TABLE?
Date: Thu, 22 May 2003 10:10:15 +0100
Message-ID: <3ECC93F7.60509@ualg.pt> (raw)
In-Reply-To: <3EC91704.1080109@Yahoo.com>
References: <pan.2003.05.09.21.21.24.908732@urbanet.ch>
	<200305141631.48642.dev@archonet.com>
	<3EC272D9.5050203@ualg.pt>
	<3EC91704.1080109@Yahoo.com>

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





view thread (9+ messages)  latest in thread

Message-ID: <3ECC93F7.60509@ualg.pt>
Permalink:  ../3ECC93F7.60509@ualg.pt/
Also on:    postgresql.org/message-id/3ECC93F7.60509@ualg.pt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: llsousa@ualg.pt, JanWieck@Yahoo.com, dev@archonet.com, fbonjour@urbanet.ch
  Subject: Re: Can arrays reference primary keys in CREATE TABLE?
  In-Reply-To: <3ECC93F7.60509@ualg.pt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox