Re: Primary Key on Inherited Table - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Primary Key on Inherited Table
Date
Msg-id 15146.957906628@sss.pgh.pa.us
Whole thread Raw
In response to Primary Key on Inherited Table  (Wenjin Zheng <wenjin.zheng@lsbc.com>)
List pgsql-hackers
Wenjin Zheng <wenjin.zheng@lsbc.com> writes:
> Is there a way to specify primary key in the child table using columns
> from parent table?  I am using 6.5.0.

It sounds like the PRIMARY KEY spec is getting processed before the
parent table reference is expanded.  That's probably a bug, but it's
not going to get fixed in 6.5 ;-).  What I'd suggest is not relying
on the PRIMARY KEY syntax, but just writing out the equivalent CREATE
UNIQUE INDEX command separately after you create the child table.

(Strictly speaking, PRIMARY KEY also implies NOT NULL on each column,
which might be hard to duplicate if you don't want the same columns
to be NOT NULL in the parent, but as long as you can set them that
way in the parent you don't need PRIMARY KEY.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Henry B. Hotz"
Date:
Subject: Re: You're on SecurityFocus.com for the cleartext passwords.
Next
From: The Hermit Hacker
Date:
Subject: Re: misc questions