Behaviour

From: Stéphane Raimbault <raimbault(dot)stephane(at)free(dot)fr>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Behaviour
Date: 2002-07-17 22:22:46
Message-ID: 1026944578.1329.9.camel@vaio
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I have the following tables :
CREATE TABLE tournee (
no_tournee SERIAL PRIMARY KEY);

CREATE TABLE fab_tournee (
id SERIAL PRIMARY KEY,
id_fab INTEGER REFERENCES fabrication ON DELETE CASCADE,
no_tournee INTEGER REFERENCES tournee ON DELETE CASCADE);

When I insert a new record into 'fab_tournee' whereas the field
'no_tournee' doesnt exist in 'tournee', I have this message :

ERROR: <unnamed> referential integrity violation - key referenced
from fab_tournee not found in tournee

but 'id' increments in 'fab_tournee'.

Is it a normal behaviour ?

*************** LOG ******************************
piid=> select * from fab_tournee ;
id | id_fab | no_tournee
----+--------+------------
(0 lignes)

piid=> insert into fab_tournee (id_fab, no_tournee) values(2, 1);
ERROR: <unnamed> referential integrity violation - key referenced from
fab_tour
nee not found in tournee
piid=> select * from tournee;
no_tournee
------------
(0 lignes)

piid=> insert into tournee values (1);
INSERT 17355 1
piid=> insert into fab_tournee (id_fab, no_tournee) values(2, 1);
INSERT 17356 1
piid=> select * from fab_tournee ;
id | id_fab | no_tournee
----+--------+------------
2 | 2 | 1
(1 ligne)
**************************************

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Philip Warner 2002-07-18 00:17:00 Re: Pg_dump Backup Drops a Few Things
Previous Message Josh Berkus 2002-07-17 18:40:46 Re: Pg_dump Backup Drops a Few Things