Re: many-to-many relationship

From: Louis-David Mitterrand <vindex+lists-pgsql-sql(at)apartia(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: many-to-many relationship
Date: 2008-10-08 09:25:10
Message-ID: 20081008092510.GA23361@apartia.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-sql by date

  From Date Subject
Next Message Sabin Coanda 2008-10-08 16:56:13 100% CPU at concurent access
Previous Message Steve Midgley 2008-10-08 00:16:39 Re: many-to-many relationship