From: Nagy László Zsolt <gandalf@shopzeus.com>
To: pgsql-admin@postgresql.org
Subject: constraint deferred but fails?
Date: Thu, 24 Jan 2019 07:35:17 +0100
Message-ID: <7db1a61c-1f0e-d233-0756-b7eecf2f420d@shopzeus.com> (raw)
Hello,
I have deferred the only fk constraint to this table inside a
transaction, but I still cannot delete rows from it.
How is that possible?
master=> ALTER TABLE doc.display_mode disable trigger user;
ALTER TABLE
master=> BEGIN;
BEGIN
master=> SET CONSTRAINTS doc.fk_book_display_mode_id DEFERRED;
SET CONSTRAINTS
master=> DELETE FROM doc.display_mode;
ERROR: update or delete on table "display_mode" violates foreign key
constraint "fk_book_display_mode_id" on table "book"
DETAIL: Key (id)=(1) is still referenced from table "book".
master=>
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-admin@postgresql.org
Cc: gandalf@shopzeus.com
Subject: Re: constraint deferred but fails?
In-Reply-To: <7db1a61c-1f0e-d233-0756-b7eecf2f420d@shopzeus.com>
* 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