PRIMARY KEY & INHERITANCE (fwd) - Mailing list pgsql-general

From Ferruccio Zamuner
Subject PRIMARY KEY & INHERITANCE (fwd)
Date
Msg-id yam8234.1812.141577424@mail.diff.org
Whole thread Raw
List pgsql-general
Hi,

please look at following example:

CREATE TABLE picture (
id serial not null,
description text,
filename text);

CREATE TABLE advert (
artist text,
customer text,
target text)
INHERITS (picture);

CREATE TABLE work (
id serial not null,
advert_id int4 not null references advert,
value numeric(6,2) default 0);

NOTICE:  CREATE TABLE will create implicit sequence 'work_id_seq' for SERIAL
col
umn 'work.id'
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'work_id_key' for
table
'work'
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR:  PRIMARY KEY for referenced table "advert" not found


How can I create PRIMARY KEY CONSTRAINT for table advert?


Thank you in advance for any reply,           \fer


pgsql-general by date:

Previous
From: Wim Ceulemans
Date:
Subject: Re: timestamps
Next
From: Tom Lane
Date:
Subject: Re: PL/PGSQL Function