Dferred constraints not deferred?

From: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
To: PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Dferred constraints not deferred?
Date: 2003-02-03 09:55:35
Message-ID: 3E3E3C97.2050100@mega-bucks.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to drop a table inside a transaction with all constraints
deferred, and then re-create the table, but PG won't let me ..

TAL=# begin;
BEGIN
TAL=# SET CONSTRAINTS ALL DEFERRED;
SET CONSTRAINTS
TAL=# drop table invoices;
NOTICE: constraint $1 on table invoice_admin_memo depends on table invoices
NOTICE: constraint $1 on table req_dlv_date depends on table invoices
NOTICE: constraint $1 on table invoice_li depends on table invoices
NOTICE: constraint $1 on table invoice_emails depends on table invoices
ERROR: Cannot drop table invoices because other objects depend on it
Use DROP ... CASCADE to drop the dependent objects too

I tought the point of "SET CONSTRAINTS ALL DEFERRED" was to make
transaction skip constraint checking until the end of a transaction ...
But in this case the foreign key constraints a checked right away ...

What I would like is to drop the table and recreate it without having PG
complain about these FK constraints until the very end of the
transaction (at which time all data will be consistant) ... is this
possible?

Thanks,

Jc

Responses

Browse pgsql-general by date

  From Date Subject
Next Message will trillich 2003-02-03 10:06:59 Re: History
Previous Message Ivar 2003-02-03 09:52:15 Re: Postgre vs SAP Db