X-Original-To: pgsql-sql@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 5D440924EC9 for ; Fri, 23 May 2003 05:21:48 -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 78196-03 for ; Fri, 23 May 2003 05:21:15 -0400 (EDT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by developer.postgresql.org (Postfix) with ESMTP id B4EB1921C04 for ; Fri, 23 May 2003 02:56:32 -0400 (EDT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.9.3/8.9.3) with ESMTP id KAA03118; Fri, 23 May 2003 10:55:42 +0400 (MSD) Date: Fri, 23 May 2003 10:55:42 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Jan Wieck Cc: Luis Sousa , Richard Huxton , Filipe Bonjour , pgsql-sql@postgresql.org Subject: Re: Can arrays reference primary keys in CREATE TABLE? In-Reply-To: <3ECCACDB.6030008@Yahoo.com> Message-ID: References: <200305141631.48642.dev@archonet.com> <3EC272D9.5050203@ualg.pt> <3EC91704.1080109@Yahoo.com> <3ECC93F7.60509@ualg.pt> <3ECCACDB.6030008@Yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/454 X-Sequence-Number: 13619 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. > > Jan > > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83