From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | Perry Smith <pedz(at)easesoftware(dot)com> |
Cc: | Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Foreign key constraint question |
Date: | 2007-07-21 00:37:42 |
Message-ID: | 1184978262.16532.237.camel@dogma.ljc.laika.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew - Supernews | 2007-07-21 01:02:20 | Re: Solved? Re: 8.2.4 signal 11 with large transaction |
Previous Message | Perry Smith | 2007-07-21 00:18:29 | Re: Foreign key constraint question |