pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: 'image' table with relationships to different objects
Date: 11 Feb 2010 11:05:38 GMT
Message-ID: <hl0oa2$l1g$6@reversiblemaps.ath.cx> (raw)
References: <20100209074909.GA11838@apartia.fr>

On 2010-02-09, Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.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.



view thread (8+ messages)

Message-ID: <hl0oa2$l1g$6@reversiblemaps.ath.cx>
Permalink:  ../hl0oa2$l1g$6@reversiblemaps.ath.cx/
Also on:    postgresql.org/message-id/hl0oa2$l1g$6@reversiblemaps.ath.cx

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasen@xnet.co.nz
  Subject: Re: 'image' table with relationships to different objects
  In-Reply-To: <hl0oa2$l1g$6@reversiblemaps.ath.cx>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox