Unable to create an inheritad table with primary key containing inherited attribute - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Unable to create an inheritad table with primary key containing inherited attribute
Date
Msg-id 200010301556.e9UFuV265552@hub.org
Whole thread Raw
List pgsql-bugs
Pascal Bourgeois (pbourgeois@atos.be) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Unable to create an inheritad  table with primary key containing inherited attribute

Long Description
If u create a table basetable having two attributes
mkey and mvalue then create a inherited table subtable (adding mykey2 and mvalue2 attributes) with primary key
containingattributes mkey and mkey2, postgres returns an error indicating that attribute mkey is not known. 

The only way to do is to create a unique index after table creation.

Sample Code
create table basetable (mykey varchar, myvalue int4, primary key (mykey));

create table subtable (mykey2 varchar, myvalue2, int4, primary key (mykey, mykey2)) inherits (basetable);

postgres will return that mykey attribute does not exists

end you have to do

create unique index subtable_pkey on subtable(mykey,mykey2);

No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Sean Kelly
Date:
Subject: Re: Updating multiple bool values crashes backend
Next
From: Thomas Lockhart
Date:
Subject: Re: RE : Postgres