From: | Malek Shabou <Malek(dot)Shabou(at)nic(dot)fr> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | problem with foreign keys |
Date: | 2000-11-14 20:04:54 |
Message-ID: | 200011142004.VAA12257@fairuz.nic.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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(dot)Shabou(at)nic(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-11-14 20:05:04 | Re: Re: [PATCHES] PostgreSQL virtual hosting support |
Previous Message | David J. MacKenzie | 2000-11-14 19:52:07 | Re: Re: [PATCHES] PostgreSQL virtual hosting support |