Re: strange "not deferrable" behaviour

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Tomasz Myrta <jasiek(at)klaster(dot)net>
Cc: Lista dyskusyjna pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: strange "not deferrable" behaviour
Date: 2003-11-17 15:16:51
Message-ID: 20031117071555.C94696@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Mon, 17 Nov 2003, Tomasz Myrta wrote:

> I've got some tables defined as:
> create table xx (
> some_column references master_table
>
> It means this column is defined by default:
> NOT DEFERRABLE, INITIALLY IMMEDIATE
>
> I tried replacing rows in this table by new ones as:
> set autocommit=off;
> begin;
> set constraints all deferred;
> delete from ....
> insert ...
> insert...
> commit;
> I get "integrity violation"... just after "delete"
>
> If I well understood manual, it works like it should. I'm not sure,
> because if I run this query in pgAdmin2, it works fine (why?) and
> replaces rows as needed.
>
> When I drop this foreign key constraint (not too easy without a
> constraint name) and recreate it as "DEFERRABLE", this query works fine
> also in psql.
>
> My question is: Why my query works fine when using pgAdmin, and it fails
> when using psql?

Hmm, I'd suggest turning on query logging to make sure pgAdmin is doing
what you expect.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2003-11-17 15:18:18 Re: Addition and subtraction on BIT type
Previous Message Yasir Malik 2003-11-17 14:32:31 Re: Addition and subtraction on BIT type