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.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to