Error on reference to inherited primary key

From: rpijlman(at)spamcop(dot)net
To: pgsql-bugs(at)postgresql(dot)org
Subject: Error on reference to inherited primary key
Date: 2001-04-13 22:40:56
Message-ID: 200104132240.f3DMeuW41447@shelob.julianhaight.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Creating tables this way:

A has a primary key
B inherits A
C references B

results in an error message on the CREATE TABLE for C (ERROR: PRIMARY KEY for referenced table "b" not found).

To reproduce:

create table A
(
id integer primary key
);

create table B
(
dummy integer
) inherits (A);

create table C
(
ref integer references B
);

psql:repro.sql:14: ERROR: PRIMARY KEY for referenced table "b" not found

AFAIK the SQL code is correct. B should inherit the primary key from A, so C should be able to reference B.

The workaround appears to be explicitly naming the primary key column:
create table C
(
ref integer references B(id)
);

I'm using PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc 2.96.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-04-14 01:44:07 Re: Compiling PG 7.0.3 undex HP-UX 10.20
Previous Message Tom Lane 2001-04-13 19:54:46 Re: Numeric modulo operator is incorrect.