Re: Foreign key constraint question - Mailing list pgsql-general

From Jeff Davis
Subject Re: Foreign key constraint question
Date
Msg-id 1184978262.16532.237.camel@dogma.ljc.laika.com
Whole thread Raw
In response to Re: Foreign key constraint question  (Perry Smith <pedz@easesoftware.com>)
Responses Re: Foreign key constraint question  (Michael Glaesemann <grzm@seespotcode.net>)
Re: Foreign key constraint question  (Nis Jørgensen <nis@superlativ.dk>)
List pgsql-general
On Fri, 2007-07-20 at 19:18 -0500, Perry Smith wrote:
> > The relational model handles inheritance and polymorphism very well if
> > you don't store types as values.
>
> What if I have just an id for an item?  This will happen when another
> table references an item.  How do I know what type it is?  Are you
> suggesting I look in companies, people, etc, etc to find the type?
> It would seem better to have a table that tells me the type.  Then
> retrieve the item from the specified table.

Why do you need to know the type? The purpose of polymorphism is that,
if you are looking to access a set of polygons, you don't care whether
an individual shape is a triangle or a square, all you care is that it's
a polygon.

If you want to access triangles specifically, you join polygons to
triangles.

> > You can use a constraint trigger. The current docs say that's "not
> > intended for general use," but it will be available for general use in
> > 8.3. And those can be deferred.
>
> I saw those but where scared away from them because of the "not for
> general use".
>

I only mentioned it because in 8.3 it will be useful for general use. I
don't know what's changing about it between now and then, but it's
becoming "un-deprecated".

It's probably wise to stay away from them until 8.3.

Regards,
    Jeff


pgsql-general by date:

Previous
From: Perry Smith
Date:
Subject: Re: Foreign key constraint question
Next
From: Andrew - Supernews
Date:
Subject: Re: Solved? Re: 8.2.4 signal 11 with large transaction