Problem (bug?) with deferred foreign key checks? - Mailing list pgsql-general

From Adrian 'Dagurashibanipal' von Bidder
Subject Problem (bug?) with deferred foreign key checks?
Date
Msg-id 1023695597.10558.66.camel@atlas
Whole thread Raw
Responses Re: Problem (bug?) with deferred foreign key checks?
Re: Problem (bug?) with deferred foreign key checks?
List pgsql-general
Yo!

Why is it not possible to temporarily have illegal values in a table,
and update them during the transaction to point to real entries in the
'super' table?

=====
avbidder=> create table super (id integer unique);
NOTICE:  [...]
CREATE
avbidder=> create table sub (sid integer references super(id) deferrable
initially deferred);
NOTICE:  [...]
CREATE
avbidder=> begin;
BEGIN
avbidder=> insert into sub values (2);
INSERT 53513 1
avbidder=> insert into super values (1);
INSERT 53514 1
avbidder=> update sub set sid = 1 where sid = 2;
UPDATE 1
avbidder=> commit;
ERROR:  <unnamed> referential integrity violation - key referenced from
sub not found in super
=====

(This is Debian package 7.1.3-7, but I'm told it's there with other
versions, too)

cheers
-- vbi


--
secure email with gpg            avbidder@fortytwo.ch: key id 0x92082481
                                 avbidder@acter.ch:    key id 0x5E4B731F


Attachment

pgsql-general by date:

Previous
From: Curt Sampson
Date:
Subject: Re: sort_mem sizing (Non-linear Performance)
Next
From: Curt Sampson
Date:
Subject: Re: How to start without password