BUG #6268: multiple update with on cascade - Mailing list pgsql-bugs

From Roman Lytovchenko
Subject BUG #6268: multiple update with on cascade
Date
Msg-id 201110250858.p9P8wtvv085658@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #6268: multiple update with on cascade  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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;

pgsql-bugs by date:

Previous
From: "Maksym Boguk"
Date:
Subject: BUG #6267: Wrong results in pg_database_size
Next
From: John R Pierce
Date:
Subject: Re: BUG #6266: Create temp tables on Slave