pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roman Lytovchenko <roman.lytovchenko@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6268: multiple update with on cascade
Date: Tue, 25 Oct 2011 08:58:55 GMT
Message-ID: <201110250858.p9P8wtvv085658@wwwmaster.postgresql.org> (raw)


The following bug has been logged online:

Bug reference:      6268
Logged by:          Roman Lytovchenko
Email address:      roman.lytovchenko@gmail.com
PostgreSQL version: 9.1.1
Operating system:   Mac OS X 10.6.8
Description:        multiple update with on cascade
Details: 

create table t2 (

    a text not null,
    b text null,
    
    constraint t2_pk primary key (a),
    
    constraint t2_t2_fk foreign key (b)
       references t2 (a) match simple
           on update cascade            --  !
           on delete cascade
               deferrable 
               initially deferred       --  !
);

insert into t2 (a, b)
values
    ('www', 'www'),
    ('asd', 'asd');
    
    
--  run this transaction in another connection!
start transaction;
    set constraints all immediate;

    update t2
    set a = '123'
    where a = 'www';
    
    select
        a, b
    from t2;
    
    --  this update failed with
    --  ERROR: insert or update on table "t2" violates foreign key
constraint "t2_t2_fk"
    --  Detail: Key (b)=(123) is not present in table "t2".

    update t2
    set a = 'kkk'
    where a = '123';

commit;



view thread (2+ messages)  latest in thread

Message-ID: <201110250858.p9P8wtvv085658@wwwmaster.postgresql.org>
Permalink:  ../201110250858.p9P8wtvv085658@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201110250858.p9P8wtvv085658@wwwmaster.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: roman.lytovchenko@gmail.com
  Subject: Re: BUG #6268: multiple update with on cascade
  In-Reply-To: <201110250858.p9P8wtvv085658@wwwmaster.postgresql.org>
  References: <201110250858.p9P8wtvv085658@wwwmaster.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox