From: amos_operation@swiss-as.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14560: FK not valid are ignored during transactions
Date: Tue, 21 Feb 2017 12:35:42 +0000
Message-ID: <20170221123542.1268.85944@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
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
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: amos_operation@swiss-as.com
Subject: Re: BUG #14560: FK not valid are ignored during transactions
In-Reply-To: <20170221123542.1268.85944@wrigleys.postgresql.org>
References: <20170221123542.1268.85944@wrigleys.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