Skip site navigation (1) Skip section navigation (2)

lost on referentail integrity

From: Patrice Beliveau <pbeliveau(at)avior(dot)ca>
To: pgsql-bugs(at)postgresql(dot)org
Subject: lost on referentail integrity
Date: 2006-12-15 19:26:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs

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 '
   return null;
' 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)


pgsql-bugs by date

Next:From: martin.pihlakDate: 2006-12-16 12:28:51
Subject: BUG #2830: Wrong results for prepared statements while clustering target table
Previous:From: SeanDate: 2006-12-15 16:07:17
Subject: BUG #2829: Runaway logs - "SSL SYSCALL error"

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group