Re: Inheritance and reference integrity

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Jani Averbach <jaa(at)cc(dot)jyu(dot)fi>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inheritance and reference integrity
Date: 2001-05-19 17:41:12
Message-ID: Pine.LNX.4.30.0105191939250.758-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jani Averbach writes:

> CREATE TABLE vehicle(
> id SERIAL,
> color TEXT,
> CONSTRAINT PK_vehicle PRIMARY KEY (id)
> );
> CREATE TABLE car(
> driver TEXT
> )INHERITS(vehicle);
> CREATE TABLE foobar(
> snafu TEXT,
> driver_id INTEGER CONSTRAINT CR_foobar_driver_id REFERENCES car (id)
> );

> psql:inherits_test.sql:25: ERROR: UNIQUE constraint matching given keys
> for referenced table "car" not found

The primary key is not inherited by "car" from "vehicle". In general,
mixing foreign keys and inheritance is not recommendable in the current
state of the implementation.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Per-Olof Pettersson 2001-05-19 19:24:54 Create an empty record
Previous Message Nils Zonneveld 2001-05-19 17:14:47 Re: I want more Money (the data type, of course! :-))