Re: 'image' table with relationships to different objects

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: 'image' table with relationships to different objects
Date: 2010-02-11 11:05:38
Message-ID: hl0oa2$l1g$6@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2010-02-09, Louis-David Mitterrand <vindex+lists-pgsql-sql(at)apartia(dot)org> wrote:
> Hello,
>
> In my database I have different object types (person, location, event,
> etc.) all of which can have several images attached.

can one image be several people?

can one image be both event and location?

> What is the best way to manage a single 'image' table with relationships
> to (potentially) many different object types while keeping referrential
> integrity (foreign keys)?

probably several join tables

image_location image_person image_event

with uniques and cascades where needed.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Louis-David Mitterrand 2010-02-12 11:14:53 "left join" not working?
Previous Message Adrian Klaver 2010-02-10 20:56:34 Re: plpgsql loop question