inheritance and primary/foreign keys

From: "Daniel J(dot) Kressin" <dkressin(at)globalcrossing(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: inheritance and primary/foreign keys
Date: 2001-03-07 23:32:06
Message-ID: 3AA6C4F6.E8DEEDD2@globalcrossing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

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 *?

Thanks for your help.
--
Dan
____ Kressin ____ .-----------------------------------.
/___ \____________/ __ \ | Unix SysAdmin |
\ \ / / \ | | Global Crossing |
___/ __\/\/rench_ \__/ | | dkressin(at)globalcrossing(dot)com |
\____/ \____/ | http://www.vib.org/wrench/ |
`-----------------------------------'

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2001-03-07 23:39:30 Re: explain -> how to optimize?
Previous Message Flemming Frøkjær 2001-03-07 23:29:19 Data types?