| From: | Nico D <nico(at)mclink(dot)it> |
|---|---|
| To: | pgsql-general(at)hub(dot)org |
| Subject: | Referential integrity and inheritance. |
| Date: | 2000-10-13 15:20:44 |
| Message-ID: | 11722.001013@mclink.it |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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=>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Steve Wolfe | 2000-10-13 15:23:06 | Re: Postgres-7.0.2 optimization question |
| Previous Message | Michael Engelhart | 2000-10-13 14:51:09 | Re: config |