Received: from vadangyal (vadangyal.vnet.hu [213.163.59.3]) by postgresql.org (Postfix) with ESMTP id 70D8A475966 for ; Wed, 13 Mar 2002 06:04:53 -0500 (EST) Received: from mail.deltav.hu (mail.deltav.hu [213.163.0.192]) by vadangyal.vnet.hu (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GSW00FAZS45P4@vadangyal.vnet.hu> for pgsql-sql@postgresql.org; Wed, 13 Mar 2002 12:04:53 +0100 (MET) Received: from pcltibor ([213.163.10.100]) by mail.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA4D76; Wed, 13 Mar 2002 12:04:52 +0100 Date: Wed, 13 Mar 2002 12:03:35 +0100 From: Laszlo Tibor Subject: Re: REFERENCES In-reply-to: <3C8F2FA9.EF9C2710@km3.de> To: Andre Schubert , pgsql-sql@postgresql.org Message-id: MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal X-Archive-Number: 200203/132 X-Sequence-Number: 7012 On Wednesday, March 13, 2002 11:53 AM Behalf Of Andre Schubert wrote: > Hi to all, > > i have a simple problem and wont request assistance fro m this list. > i have to tables > > foo: > id int8 UNIQUE > > bar: > id int8 UNIQUE > foo_id int8 > > Now i wont foo_id to be a id which exists in the foo, this could be done > with foo_id REFERENCES foo (id). > But what should i do if i want foo_id to be a id existing in foo or to > be zero(0). > I have created a view as "select id from foo UNION select 0" and tried > to REFERENCE against this view, but that > doesnt work. > Can this problem be solved by a somebody ???? > > Thanks Why do you want to use zeros? A foreign key could be NULL. Regards, Tibor ltibor@mail.tiszanet.hu