constraint deferred but fails?

From: Nagy László Zsolt <gandalf(at)shopzeus(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: constraint deferred but fails?
Date: 2019-01-24 06:35:17
Message-ID: 7db1a61c-1f0e-d233-0756-b7eecf2f420d@shopzeus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


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=>

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2019-01-24 06:39:52 Re: constraint deferred but fails?
Previous Message Shreeyansh Dba 2019-01-24 01:56:14 Re: Creation of temporary tables on a publisher