agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: gvim <gvimrc@gmail.com>
To: pgsql-sql@postgresql.org
Subject: 3 foreign keys in 1 table for 3 1-to-many relations?
Date: Thu, 18 Jun 2015 01:51:43 +0100
Message-ID: <5582161F.7070809@gmail.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

I have 3 tables A, B & C each of which has a 1-to-many relation with a 
Comments table but I can't fathom how to set up the foreign key(s) in 
Comments without resorting to distinct A_id, B_id & C_id columns in 
Comments and enforcing 2 of the 3 columns be NULL for a given row. Seems 
ugly.

gvim


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (2+ messages)  latest in thread

Message-ID: <5582161F.7070809@gmail.com>
Permalink:  ../5582161F.7070809@gmail.com/
Also on:    postgresql.org/message-id/5582161F.7070809@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: gvimrc@gmail.com
  Subject: Re: 3 foreign keys in 1 table for 3 1-to-many relations?
  In-Reply-To: <5582161F.7070809@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox