From: Kaloyan Iliev <news1@faith.digsys.bg>
To: pgsql-sql@postgresql.org
Subject: Problem with SET CONSTRAINTS ALL DEFERRED;
Date: Fri, 19 May 2006 14:30:43 +0300
Message-ID: <446DAC63.1080701@faith.digsys.bg> (raw)
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: news1@faith.digsys.bg
Subject: Re: Problem with SET CONSTRAINTS ALL DEFERRED;
In-Reply-To: <446DAC63.1080701@faith.digsys.bg>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox