Re: many-to-many relationship - Mailing list pgsql-sql

From Louis-David Mitterrand
Subject Re: many-to-many relationship
Date
Msg-id 20081008092510.GA23361@apartia.fr
Whole thread Raw
In response to many-to-many relationship  (Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>)
List pgsql-sql
On Tue, Oct 07, 2008 at 05:16:39PM -0700, Steve Midgley wrote:
>
> I think the relationship tables method works pretty well but I have  
> another suggestion. You could store the Foreign table name within image  
> table as well as the Foreign key.
>
> |id|image_url|f_table|f_key
> |1 |url......|person |1234
> |2 |url2.....|event  |5678
>
> I think this is called a "polymorphic join" but I could be wrong about  
> that. I'd guess you could construct a rule or trigger to validate the  
> foreign key data on insert/update but that's out of my skill area.

Hi Steve,

So in your solution the f_table column is just text which needs to be 
validated by a custom trigger?

-- 
http://www.lesculturelles.net


pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: many-to-many relationship
Next
From: "Sabin Coanda"
Date:
Subject: 100% CPU at concurent access