dbTalk Databases Forums  

[BUGS] lost on referentail integrity

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] lost on referentail integrity in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Patrice Beliveau
 
Posts: n/a

Default [BUGS] lost on referentail integrity - 12-16-2006 , 04:04 PM






Hi,

I'm using PostgreSQL 8.1.4

The problem is very simple to reproduce:


create table test1 (
pk1 text not null,
df1 text,
primary key(pk1)
);

create table test2 (
pk1 text not null,
pk2 text not null,
df2 text,
primary key(pk1,pk2)
);

alter table test2 add constraint c1 foreign key (pk1) references test1(pk1)
on update cascade
on delete cascade;

create or replace function f1() returns "trigger" as '
begin
return null;
end;
' language "plpgsql";

create trigger trig1 before delete on test2 for each row execute
procedure f1();

insert into test1 values('foo','foo');

insert into test2 values('foo','oof','foooof');

delete from test1;

select * from test2;
pk1 | pk2 | df2
-----+-----+--------
foo | oof | foooof
(1 row)

select * from test1;
pk1 | df1
-----+-----
(0 rows)



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] lost on referentail integrity - 12-16-2006 , 04:40 PM






Patrice Beliveau <pbeliveau (AT) avior (DOT) ca> writes:
Quote:
The problem is very simple to reproduce:
[ shrug... ] Your trigger suppressed the cascaded deletes. What were
you expecting to happen?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.