Re: Referential integrity and inheritance.

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Nico D <nico(at)mclink(dot)it>
Cc: pgsql-general(at)hub(dot)org
Subject: Re: Referential integrity and inheritance.
Date: 2000-10-13 16:36:25
Message-ID: Pine.BSF.4.10.10010130933590.51468-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


RI constraints do not follow inheritance trees at this time.
The constraint is looking for rows in objects (not objects*) for
the matching pk value. There really isn't a work around I can think
of at this time.

Stephan Szabo
sszabo(at)bigpanda(dot)com

On Fri, 13 Oct 2000, Nico D wrote:

> Please let me know what I've missed about the referential
> integrity ?
> (using PG v.7.0.2)
>
>
> test=> create table objects (id serial);
> NOTICE: CREATE TABLE will create implicit sequence 'objects_id_seq' for SERIAL column 'objects.id'
> NOTICE: CREATE TABLE/UNIQUE will create implicit index 'objects_id_key' for table 'objects'
> CREATE
>
> test=> create table books (title name) inherits(objects);
> CREATE
>
> test=> create table opinions (idobject int4 REFERENCES objects(id) ON UPDATE CASCADE, comment text);
> NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
> NOTICE: _outNode: don't know how to print type 726
> CREATE
>
> test=> insert into books (title) values ('DataBases');
> INSERT 691707 1
> test=> select * from objects*;
> id
> ----
> 1
> (1 row)
>
> test=> select * from books;
> id | title
> ----+-----------
> 1 | DataBases
> (1 row)
>
> test=> insert into opinions (idobject, comment) values (1, 'Very Wise');
> ERROR: <unnamed> referential integrity violation - key referenced from opinions not found in objects
>
> test=>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ross J. Reedstrom 2000-10-13 17:00:28 Re: [HACKERS] My new job
Previous Message Sergio A. Kessler 2000-10-13 16:36:14 using cr/lf files in copy from