Re: many to one of many modeling question

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Kevin Hunter <hunteke(at)earlham(dot)edu>
Cc: Postgres General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: many to one of many modeling question
Date: 2008-01-11 22:39:54
Message-ID: 193563.21773.qm@web31807.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

--- On Fri, 1/11/08, David Fetter <david(at)fetter(dot)org> wrote:

> > 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.

Actually, I think if you notice the example I posted previously, I made both the Unique ID column and object type column a composite primary key.

The other tables referenced this composite primary key as foreign keys using referential integrity ON UPDATE CASCADE. This means that they database ~would~ maintain/enforce the object-type portion of the foreign key automatically for you.

Regards,
Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Wilson 2008-01-11 23:51:08 ECPG problem with 8.3
Previous Message David Fetter 2008-01-11 22:11:51 Re: many to one of many modeling question