The following bug has been logged on the website:
Bug reference: 14560
Logged by: AMOS Operation
Email address: amos_operation@swiss-as.com
PostgreSQL version: 9.5.5
Operating system: Linux
Description:
Hello,
With a "not valid" FK, I can run single updates without error. But running
the same updates inside a transaction does not work.
Example:
create table source (id int, fk int, name character varying(10));
create table target (id int, name character varying(10));
alter table source add constraint pk_source primary key (id);
alter table target add constraint pk_target primary key (id);
insert into source values (1,99,'test');
alter table source add constraint fk_test foreign key (fk) references
target(id) not valid;
update source set name = 'twice' where id = 1; => works
update source set name = 'other' where id = 1; => works
begin;
update source set name = 'unknow2' where id = 4;
update source set name = 'unknow3' where id = 4;
commit; => does not work:
ERROR: insert or update on table "source" violates foreign key constraint
"fk_test"
DETAIL: Key (fk)=(99) is not present in table "target".
Thanks !
Olivier
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs