Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 99C93B5DC5E for ; Tue, 25 Oct 2011 05:58:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 14728-07 for ; Tue, 25 Oct 2011 08:58:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id D2C29B5DC5D for ; Tue, 25 Oct 2011 05:58:55 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p9P8wtIP085659 for ; Tue, 25 Oct 2011 08:58:55 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p9P8wtvv085658; Tue, 25 Oct 2011 08:58:55 GMT (envelope-from www) Date: Tue, 25 Oct 2011 08:58:55 GMT Message-Id: <201110250858.p9P8wtvv085658@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6268: multiple update with on cascade From: "Roman Lytovchenko" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201110/224 X-Sequence-Number: 31494 The following bug has been logged online: Bug reference: 6268 Logged by: Roman Lytovchenko Email address: roman.lytovchenko@gmail.com PostgreSQL version: 9.1.1 Operating system: Mac OS X 10.6.8 Description: multiple update with on cascade Details: create table t2 ( a text not null, b text null, constraint t2_pk primary key (a), constraint t2_t2_fk foreign key (b) references t2 (a) match simple on update cascade -- ! on delete cascade deferrable initially deferred -- ! ); insert into t2 (a, b) values ('www', 'www'), ('asd', 'asd'); -- run this transaction in another connection! start transaction; set constraints all immediate; update t2 set a = '123' where a = 'www'; select a, b from t2; -- this update failed with -- ERROR: insert or update on table "t2" violates foreign key constraint "t2_t2_fk" -- Detail: Key (b)=(123) is not present in table "t2". update t2 set a = 'kkk' where a = '123'; commit;