Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select version();
- PostgreSQL 8.4.6 on i386-apple-darwin, compiled by GCC i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5370), 32-bit
- PostgreSQL 9.1.1 on x86_64-apple-darwin10.8.0, compiled by i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3), 64-bit
- drop table if exists t2;
- 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 -- !
- );
- --Test data
- insert into t2
- values
- ('asd', 'www'),
- ('www', 'asd');
- start transaction;
- set constraints all immediate; -- If not switched then everything is ok
- -- set constraints all deferred;
- update t2
- set a = '123'
- where a = 'asd';
- select * from t2;
- update t2
- set a = 'kkk'
- where a = '123'; --have a error here
- commit;
Add Comment
Please, Sign In to add comment