pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reece Hart <rkh@gene.COM>
To: James Gregory <james@anchor.net.au>
Cc: pgsql-general@postgresql.org
Subject: Re: table inheritance and foreign keys
Date: 16 May 2003 09:23:13 -0700
Message-ID: <1053102193.5829.1022.camel@tallac> (raw)
In-Reply-To: <1052980983.5672.7.camel@pirate.bridge.anchor.net.au>
References: <1052957276.5829.53.camel@tallac>
	<1052980983.5672.7.camel@pirate.bridge.anchor.net.au>

James-

Thanks for your advice.  I think I'll opt for the following approach
instead, but I'm interested to hear of any pitfalls you foresee.

Subtables (for which I wanted to use inherit) will instead contain only
the subtable-specific columns, and in addition contain a foreign key
into the parent table.  A view with insert, update, and delete rules can
emulate the appearance of a full subtable (ie, inherited and
subtable-specific columns).

The upside I see over triggers is that the referential integrity is
still on postgresql's back.  The downside is that I end up with more
tables and views to maintain and an extra join in many cases.

Again, thanks for your advice.  Do you see any reason that the above
sketch wouldn't work to emulate foreign keys into inherited tables?

-Reece

-- 
Reece Hart, Ph.D.                       rkh@gene.com, http://www.gene.com/
Genentech, Inc.                         650/225-6133 (voice), -5389 (fax)
Bioinformatics and Protein Engineering
1 DNA Way, MS-93                        http://www.in-machina.com/~reece/
South San Francisco, CA  94080-4990     reece@in-machina.com, GPG: 0x25EC91A0




view thread (6+ messages)  latest in thread

Message-ID: <1053102193.5829.1022.camel@tallac>
Permalink:  ../1053102193.5829.1022.camel@tallac/
Also on:    postgresql.org/message-id/1053102193.5829.1022.camel@tallac

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: rkh@gene.COM, james@anchor.net.au
  Subject: Re: table inheritance and foreign keys
  In-Reply-To: <1053102193.5829.1022.camel@tallac>
  References: <1052957276.5829.53.camel@tallac> <1052980983.5672.7.camel@pirate.bridge.anchor.net.au> <1053102193.5829.1022.camel@tallac>

* 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