many to one of many modeling question - Mailing list pgsql-general

From Kevin Hunter
Subject many to one of many modeling question
Date
Msg-id 478261CA.5090503@earlham.edu
Whole thread Raw
Responses Re: many to one of many modeling question  (brian <brian@zijn-digital.com>)
Re: many to one of many modeling question  (David Fetter <david@fetter.org>)
List pgsql-general
Hi List,

I have multiple objects to which I'd like to associate comments.  I'd
like this to be a many to one relationship, so that each object can have
many different comments.  The issue is how to have one comment table.
One method that has been proposed is to have a third table which stores
to what object type a comment belongs, but I don't like this because the
foreign key relationships then wouldn't be maintained by the database.
The only way that I'm able to think of at the moment is multiple columns.

Is there a clever/clean way of having the comments foreign key into the
multiple tables?

Thanks,

Kevin

pgsql-general by date:

Previous
From: Jean-Michel Pouré
Date:
Subject: calculating shared data memory space
Next
From: Shelby Cain
Date:
Subject: Re: PhpBB 3.x query review