

 Hi,
 i have a problem with REFERENCES (foreign keys). i have this table:

drop table paragraph;
create table paragraph (
 id int4  PRIMARY KEY,
 label varchar(512),
 paragraph_next int4 CONSTRAINT paragraph_fk_next REFERENCES paragraph DEFERRABLE INITIALLY DEFERRED,
 paragraph_priv int4 CONSTRAINT paragraph_fk_priv REFERENCES paragraph DEFERRABLE INITIALLY DEFERRED
);

 if a excute this statements a recive a CONSTRAINT probleme:



begin;
insert into paragraph values (1,'par1',null,null);
insert into paragraph values (2,'par2',null,1);
update paragraph set paragraph_next = 2 where id = 1;
end;

and then:

begin; 
delete from paragraph;
insert into paragraph values (1,'par11',null,null);
insert into paragraph values (2,'par22',null,1);
update paragraph set paragraph_next = 2 where id = 1;
end;                         

i recive:
ERROR:  paragraph_fk_next referential integrity violation - key in paragraph still referenced from paragraph


 Regards,

----
Malek Shabou				    E-mail: Malek.Shabou@nic.fr
AFNIC France				    Tel: +33 1 39 63 50 15
c/o INRIA-Rocquencourt Domaine de Voluceau  Fax: +33 1 39 63 55 34 
B.P.105 78153 Le Chesnay Cedex

Tue, 14 Nov 2000 21:04:54 +0100
Malek Shabou <Malek.Shabou@nic.fr>
problem with foreign keys