Re: Inheritance and reference integrity - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Inheritance and reference integrity
Date
Msg-id Pine.LNX.4.30.0105191939250.758-100000@peter.localdomain
Whole thread Raw
In response to Inheritance and reference integrity  (Jani Averbach <jaa@cc.jyu.fi>)
List 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@gmx.net   http://funkturm.homeip.net/~peter


pgsql-general by date:

Previous
From: Jani Averbach
Date:
Subject: Inheritance and reference integrity
Next
From: Per-Olof Pettersson
Date:
Subject: Create an empty record