Problem (bug?) with deferred foreign key checks?

From: Adrian 'Dagurashibanipal' von Bidder <avbidder(at)fortytwo(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Cc: Diana Senn <diana(at)fortytwo(dot)ch>
Subject: Problem (bug?) with deferred foreign key checks?
Date: 2002-06-10 07:53:17
Message-ID: 1023695597.10558.66.camel@atlas
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fortytwo(dot)ch: key id 0x92082481
avbidder(at)acter(dot)ch: key id 0x5E4B731F

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Curt Sampson 2002-06-10 08:32:47 Re: How to start without password
Previous Message Curt Sampson 2002-06-10 07:48:41 Re: sort_mem sizing (Non-linear Performance)