X-Original-To: pgsql-sql@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 1560C9251CB for ; Mon, 19 May 2003 17:51:26 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 27083-06 for ; Mon, 19 May 2003 17:51:22 -0400 (EDT) Received: from europa.janwieck.net (h00045a2e4e7c.ne.client2.attbi.com [24.131.181.55]) by developer.postgresql.org (Postfix) with ESMTP id 292149259B0 for ; Mon, 19 May 2003 13:41:32 -0400 (EDT) Received: from Yahoo.com (linksys.janwieck.net [192.168.192.1]) (authenticated) by europa.janwieck.net (8.11.6/8.11.6) with ESMTP id h4JHesa02627; Mon, 19 May 2003 13:40:55 -0400 Message-ID: <3EC91704.1080109@Yahoo.com> Date: Mon, 19 May 2003 13:40:20 -0400 From: Jan Wieck Organization: Unorganized User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luis Sousa Cc: Richard Huxton , Filipe Bonjour , pgsql-sql@postgresql.org Subject: Re: Can arrays reference primary keys in CREATE TABLE? References: <200305141631.48642.dev@archonet.com> <3EC272D9.5050203@ualg.pt> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/364 X-Sequence-Number: 13529 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 -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #