3 foreign keys in 1 table for 3 1-to-many relations?

From: gvim <gvimrc(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: 3 foreign keys in 1 table for 3 1-to-many relations?
Date: 2015-06-18 00:51:43
Message-ID: 5582161F.7070809@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David G. Johnston 2015-06-18 01:30:11 Re: 3 foreign keys in 1 table for 3 1-to-many relations?
Previous Message Stephen Tahmosh 2015-06-17 15:34:10 Re: EnterpriseDB: PostgreSql 9.4 Where is the Language Pack Installer?