From: | Antonin Houska <ah(at)cybertec(dot)at> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Foreign key validation failure in 18beta1 |
Date: | 2025-05-28 07:51:15 |
Message-ID: | 26983.1748418675@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | jian he | 2025-05-28 09:09:43 | ALTER TABLE ALTER CONSTRAINT misleading error message |
Previous Message | jian he | 2025-05-28 07:38:51 | Re: ALTER DOMAIN ADD NOT NULL NOT VALID |