pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Neil Saunders <n.j.saunders@gmail.com>
To: Joost Kraaijeveld <J.Kraaijeveld@askesis.nl>
Cc: Pgsql-sql@postgresql.org <Pgsql-sql@postgresql.org>
Subject: Re: Foreign key to 2 tables problem
Date: Tue, 22 Nov 2005 15:31:07 +0000
Message-ID: <ddcd549e0511220731p11b4fd86v6d9b56e4d0144262@mail.gmail.com> (raw)
In-Reply-To: <1132673053.5701.9.camel@Panoramix>
References: <1132673053.5701.9.camel@Panoramix>

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



view thread (6+ messages)  latest in thread

Message-ID: <ddcd549e0511220731p11b4fd86v6d9b56e4d0144262@mail.gmail.com>
Permalink:  ../ddcd549e0511220731p11b4fd86v6d9b56e4d0144262@mail.gmail.com/
Also on:    postgresql.org/message-id/ddcd549e0511220731p11b4fd86v6d9b56e4d0144262@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: n.j.saunders@gmail.com, J.Kraaijeveld@askesis.nl
  Subject: Re: Foreign key to 2 tables problem
  In-Reply-To: <ddcd549e0511220731p11b4fd86v6d9b56e4d0144262@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox