From: Antonin Houska <ah@cybertec.at>
To: pgsql-hackers@lists.postgresql.org
Subject: Foreign key validation failure in 18beta1
Date: Wed, 28 May 2025 09:51:15 +0200
Message-ID: <26983.1748418675@localhost> (raw)
I've come across an unexpected ERROR during validation of FK constraint in PG
18beta1. The same works in PG 17:
drop table if exists fk;
drop table if exists pk;
create table pk(i int primary key) partition by range (i);
create table pk_1 partition of pk for values from (0) to (1);
create table pk_2 partition of pk for values from (1) to (2);
insert into pk values (0), (1);
create table fk(i int);
insert into fk values (1);
-- Works if the FK constraint is created as valid.
--alter table fk add foreign key(i) references pk;
-- Fails if the FK constraint is created as NOT VALID and validated
-- afterwards.
alter table fk add foreign key(i) references pk not valid;
alter table fk validate constraint fk_i_fkey;
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: ah@cybertec.at, pgsql-hackers@lists.postgresql.org
Subject: Re: Foreign key validation failure in 18beta1
In-Reply-To: <26983.1748418675@localhost>
* 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