X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4FAAB47641F for ; Wed, 14 May 2003 12:50:53 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 95021-02 for ; Wed, 14 May 2003 12:50:49 -0400 (EDT) Received: from mail.deltav.hu (mail.deltav.hu [213.163.0.192]) by postgresql.org (Postfix) with ESMTP id E4DDE4763D6 for ; Wed, 14 May 2003 12:50:45 -0400 (EDT) Received: from fejleszt2 ([213.163.10.103]) by mail.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA53D4 for ; Wed, 14 May 2003 18:50:50 +0200 Message-ID: <017b01c31a38$f8cf1ec0$0a03a8c0@fejleszt2> From: =?iso-8859-1?Q?SZUCS_G=E1bor?= To: References: <000b01c314aa$70f58400$f100000a@IT001> Subject: Re: array in a reference Date: Wed, 14 May 2003 18:50:48 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/289 X-Sequence-Number: 13454 Ries, ----- Original Message ----- From: "Ries van Twisk" Sent: Wednesday, May 07, 2003 5:07 PM > CREATE TABLE t0 { > id SERIAL, > value TEXT > } > > CREATE TABLE t1 { > id SERIAL, > t0id INTEGER[] REFERENCES t0(id) -- <<<< Is this possible???? > } I'd use a third table: CREATE TABLE t1 ( id SERIAL ); CREATE TABLE t1_refs_t0 ( t0id integer NOT NULL REFERENCES t0(id), t1id integer NOT NULL REFERENCES t1(id) -- Probably you'd like to add some unique constraint (if the orig. array -- shouldn't contain equal values): , UNIQUE (t1id, t0id) ); And maybe a trigger (after insert/update on t1) to check that actually there are rows in the refs table for the new t1.id, but I can't really find out the correct syntax now :) G. -- while (!asleep()) sheep++; ---------------------------- cut here ------------------------------