Re: Foreign key to 2 tables problem

From: Neil Saunders <n(dot)j(dot)saunders(at)gmail(dot)com>
To: Joost Kraaijeveld <J(dot)Kraaijeveld(at)askesis(dot)nl>
Cc: "Pgsql-sql(at)postgresql(dot)org" <Pgsql-sql(at)postgresql(dot)org>
Subject: Re: Foreign key to 2 tables problem
Date: 2005-11-22 15:31:07
Message-ID: ddcd549e0511220731p11b4fd86v6d9b56e4d0144262@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 <J(dot)Kraaijeveld(at)askesis(dot)nl> 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(dot)Kraaijeveld(at)Askesis(dot)nl
> web: www.askesis.nl
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John McCawley 2005-11-22 15:37:33 Re: Foreign key to 2 tables problem
Previous Message Joost Kraaijeveld 2005-11-22 15:24:13 Foreign key to 2 tables problem