Re: inheritance and primary/foreign keys - Mailing list pgsql-general

From Eric G. Miller
Subject Re: inheritance and primary/foreign keys
Date
Msg-id 20010308181437.C26629@calico.local
Whole thread Raw
In response to Re: inheritance and primary/foreign keys  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
On Wed, Mar 07, 2001 at 03:54:02PM -0800, Stephan Szabo wrote:
> On Wed, 7 Mar 2001, Daniel J. Kressin wrote:
>
> > Question 1: If table A has as its primary key "a_pk" and table B
> > inherits table A, then table B also has as its primary key a_pk.  Is
> > that correct?
>
> I don't believe so currently.
>
> > Question 2: If I want table C to have a foreign key on both A and B, is
> > the following syntax correct? (I'm using 7.0.3)
> >     CREATE TABLE c (
> >         c_fk    correct_type    REFERENCES a*(a_pk)
> >     );
> > (The question is, Do I need the *?)
> >
> > Question 3: I understand that the default action on this will reverse in
> > 7.1 (i.e. the default will then be to reference all tables unless ONLY
> > is specified).  Am I correct in assuming that the dump/restore (required
> > for upgrading) will take care of this, or will I need to recreate table
> > C manually removing the *?
>
> You cannot safely reference tops of inheritance trees under 7.0 or 7.1 and
> have it reference the trees.
>
> Which reminds me, the fk constraint triggers should probably specify ONLY
> on their queries or they'll fail strangely under 7.1.

Can someone give a good use for this inheritance thing?  I've never been
able to come up with a scenario where it makes sense.  It always seems
more problematic than just using multiple related tables.

--
Eric G. Miller <egm2@jps.net>

pgsql-general by date:

Previous
From: Einar Karttunen
Date:
Subject: Re: inheritance and primary/foreign keys
Next
From: "Richard Huxton"
Date:
Subject: Re: Escaping underscores in LIKE