Inheritance and reference integrity

From: Jani Averbach <jaa(at)cc(dot)jyu(dot)fi>
To: pgsql-general(at)postgresql(dot)org
Subject: Inheritance and reference integrity
Date: 2001-05-19 15:53:10
Message-ID: Pine.GSO.4.21.0105191844030.11541-100000@tukki
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi!

I wonder why following SQL-sequence will fail:

-- DROP TABLE car;
-- DROP TABLE vehicle;
-- DROP SEQUENCE vehicle_id_seq;

CREATE TABLE vehicle(
id SERIAL,
color TEXT,
--
CONSTRAINT PK_vehicle PRIMARY KEY (id)
);


CREATE TABLE car(
driver TEXT
)INHERITS(vehicle);


-- DROP TABLE foobar;

CREATE TABLE foobar(
snafu TEXT,
driver_id INTEGER CONSTRAINT CR_foobar_driver_id REFERENCES car (id)
);

Result:

psql:inherits_test.sql:25: NOTICE: CREATE TABLE will create implicit
trigger(s) for FOREIGN KEY check(s)
psql:inherits_test.sql:25: ERROR: UNIQUE constraint matching given keys
for referenced table "car" not found

Is it just me or postgres? =)

BR, Jani

P.S. My Postgresql's version number is 7.1.

---
Jani Averbach

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nils Zonneveld 2001-05-19 17:14:47 Re: I want more Money (the data type, of course! :-))
Previous Message R Talbot 2001-05-19 15:44:05 Compiling for Caldera