X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 321A5DB0B8 for ; Tue, 22 Nov 2005 11:31:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64437-02 for ; Tue, 22 Nov 2005 15:31:10 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.205]) by svr1.postgresql.org (Postfix) with ESMTP id 07069DB09D for ; Tue, 22 Nov 2005 11:31:03 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 13so1040785nzp for ; Tue, 22 Nov 2005 07:31:09 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MSqhyAf3myKkxH/ysAlGaBVeCgptLzV9O/gHgdPAj+K5rPv+j/gKCTTpE8xM1t6ccpOIdP7oPzbo+S81Q28qu6FO7b48fI2y57LAbK96TIP+WoeP1zTsYvWcDwZgNPhmgHvm9u2DmDNoRncF8OFCx9eGcTH0l7PVry/n48L+d70= Received: by 10.65.137.14 with SMTP id p14mr4709348qbn; Tue, 22 Nov 2005 07:31:08 -0800 (PST) Received: by 10.65.224.16 with HTTP; Tue, 22 Nov 2005 07:31:07 -0800 (PST) Message-ID: Date: Tue, 22 Nov 2005 15:31:07 +0000 From: Neil Saunders To: Joost Kraaijeveld Subject: Re: Foreign key to 2 tables problem Cc: "Pgsql-sql@postgresql.org" In-Reply-To: <1132673053.5701.9.camel@Panoramix> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1132673053.5701.9.camel@Panoramix> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/195 X-Sequence-Number: 23446 As far as I'm aware, not without using an intermediatary table (id, cust_id, supplier_id) . Otherwise, how would you know which table the foreign key was referencing? That said, an intermediatary table isn't a very clean solution; What problem are you trying to solve, exactly? Kind Regards, Neil. On 11/22/05, Joost Kraaijeveld wrote: > Hi, > > Is there a way to create a foreign key to 2 tables: e.g. a bankaccount > table that has a column "owner", that must point to a record in either > the customer or the supplier table? > > > TIA > > -- > Groeten, > > Joost Kraaijeveld > Askesis B.V. > Molukkenstraat 14 > 6524NB Nijmegen > tel: 024-3888063 / 06-51855277 > fax: 024-3608416 > e-mail: J.Kraaijeveld@Askesis.nl > web: www.askesis.nl > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq >