X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8A4689F9AFD for ; Fri, 19 May 2006 08:31:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 43170-04 for ; Fri, 19 May 2006 08:30:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from danbo.digsys.bg (danbo.digsys.bg [192.92.129.13]) by postgresql.org (Postfix) with ESMTP id 123049FA682 for ; Fri, 19 May 2006 08:30:52 -0300 (ADT) Received: from [193.68.6.22] (kaloyan@luke.digsys.bg [193.68.6.22]) by danbo.digsys.bg (8.11.6/8.10.1) with ESMTP id k4JBUkp23210 for ; Fri, 19 May 2006 14:30:46 +0300 (EEST) Message-ID: <446DAC63.1080701@faith.digsys.bg> Date: Fri, 19 May 2006 14:30:43 +0300 From: Kaloyan Iliev User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060117 X-Accept-Language: bg, en, en-us MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Problem with SET CONSTRAINTS ALL DEFERRED; Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/155 X-Sequence-Number: 25186 Hi Friends, I am trying to postpone the foreign key constraint check till the end of transaction but it doesn't work. Can anyone help me with a tip what I am doing wrong. Thanks in advance. Kaloyan Iliev test=# BEGIN; BEGIN test=# test=# SET CONSTRAINTS ALL DEFERRED; SET CONSTRAINTS test=# DELETE FROM picture test-# USING element_picture test-# WHERE picture.id = element_picture.picture_id test-# AND element_picture.element_id = 8; ERROR: update or delete on "picture" violates foreign key constraint "picture_id" on "element_picture" DETAIL: Key (id)=(223) is still referenced from table "element_picture". select version(); version ------------------------------------------------------------------------------------------------ PostgreSQL 8.1.2 on i386-portbld-freebsd6.0, compiled by GCC cc (GCC) 3.4.4 [FreeBSD] 20050518 (1 row)