Search Postgresql Archives

Re: Foreign key constraint question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux