many to one of many modeling question

From: Kevin Hunter <hunteke(at)earlham(dot)edu>
To: Postgres General List <pgsql-general(at)postgresql(dot)org>
Subject: many to one of many modeling question
Date: 2008-01-07 17:30:50
Message-ID: 478261CA.5090503@earlham.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shelby Cain 2008-01-07 17:37:45 Re: PhpBB 3.x query review
Previous Message Jean-Michel Pouré 2008-01-07 17:29:44 calculating shared data memory space