Re: BUG #14560: FK not valid are ignored during transactions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: amos_operation(at)swiss-as(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14560: FK not valid are ignored during transactions
Date: 2017-02-21 15:39:38
Message-ID: CAKFQuwZW1x4MPOCHxwNVJbniqUbm8LfmWvmwg5Ap_0N1We9cTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Feb 21, 2017 at 5:35 AM, <amos_operation(at)swiss-as(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 14560
> Logged by: AMOS Operation
> Email address: amos_operation(at)swiss-as(dot)com
> PostgreSQL version: 9.5.5
> Operating system: Linux
> Description:
>
> alter table source add constraint fk_test foreign key (fk) references
> target(id) not valid;
>

​Working as documented.

"""
[...] NOT VALID, ​which is currently only allowed for foreign key and CHECK
constraints. If the constraint is marked NOT VALID, the potentially-lengthy
initial check to verify that all rows in the table satisfy the constraint
is skipped. The constraint will still be enforced against subsequent
inserts or updates (that is, they'll fail unless there is a matching row in
the referenced table, in the case of foreign keys; and they'll fail unless
the new row matches the specified check constraints)
"""

https://www.postgresql.org/docs/9.6/static/sql-altertable.html

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-02-21 15:44:34 Re: BUG #14560: FK not valid are ignored during transactions
Previous Message mjsbeaton 2017-02-21 13:20:20 BUG #14561: Unexpected disk buffer in FETCH handling