Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wB6KT-000jgK-2G for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Apr 2026 07:31:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wB6JT-00AHFR-07 for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Apr 2026 07:29:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wB6JS-00AHF8-2B for pgsql-bugs@lists.postgresql.org; Fri, 10 Apr 2026 07:29:59 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wB6JR-00000000JVi-1GkM for pgsql-bugs@lists.postgresql.org; Fri, 10 Apr 2026 07:29:59 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-b9c6680aaf8so309529166b.3 for ; Fri, 10 Apr 2026 00:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775806196; cv=none; d=google.com; s=arc-20240605; b=T5vQ3NZKibSM4vUlNZ+yWz5moIuegY5a0m2o88IOsAKxPMtwGDrYoBaPoTHL/shTmm 0xwqpuZOuKOrS9p3TmjtHeXjPtdObi7B1YZqObDZboJj2ANLpdGvLcfv5pxvt8Jw5TpG zlo6CuBB3odYTTRewLm4Xnb5Kfs8st1d/xANtQ2Qz9T+Hlye65ShacPCyAjWtmrICcG0 CTeOAv5yrODfTfIp55q3RcwRVU6h1SCty1Rf0dQRhtJrXtaZGx3tjHRt2bECR0sBKRDx Y6xXhAzhWeuy4Uuw4WQAyP5LSg5lbYO7ZFwpdsGaJowVCq/4axChDA0hd0h7ovcuBX6g t+hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=dC3gCs5jBLwd+UzcMjdZyYpILaLYJ9JCVl3g+oUxQ8g=; fh=g7umXLPzIiC/RDJfx1UcsSiVhsv3C/mnPOfX/ogQu9s=; b=ggX3W4StDuuLmx6A8jfV2BFXMBS536wmp2wtoWq47GWrqOpteXTg3tRD/g7L36XdPZ Fh6/8rW1WX1KJaVNpzJPl60/tN1Ct5K5tNIyGtP3FVOy1adX4Bc8wfbQg5K5iRf6nNbV LuqTUUJRW6o4HY0eXZ33xHRF/MTTvPuFESo66GJH1Woz4DiwyjcWyUiEKscrbLtDFpcN z/t+9k/Q/WxyNYamdqwZAECplZ4Mfu1qfpgwd0g/fFA6+LUOdb4ukfMOvvBqUzaE9/in sf3OlIl8LqbVZH5QSOwB5p38hiKNeAUNH6VaQK6xHhDqP2xuBGESnbL7259PVSwG9qzj rh8A==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digpro-se.20251104.gappssmtp.com; s=20251104; t=1775806196; x=1776410996; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dC3gCs5jBLwd+UzcMjdZyYpILaLYJ9JCVl3g+oUxQ8g=; b=ZWYtfFcU2qSFeJTQRmdykjflf4oOmotgOQFDhpWfo6QdvuDIBZmV0llqzSkja4jDyP YKxPf7HB8fE39KRkWjuktDCYpTJ5FykCbWlJDQYgcbXwXo//ORjPJLJttVTbmY+weYMD UH7RNSxwcNImwY/K4uf/O7+pNeoLr683xtkDnt5tKwun6rsGL+f2KoL5oEYHWK42k5pa R+O3LrTRc6RBYZYXpuwY6U3ZA3A+ch8wvVLZrawAlv09QU+hqGJtY/l8w8N5BAcQPway z5ub9vdD3awn2csrMIk8qg26QKC4Eut+YyVUg48XFjVdtXNPGoup0JiP78RkX2bM8I4I XKgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775806196; x=1776410996; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dC3gCs5jBLwd+UzcMjdZyYpILaLYJ9JCVl3g+oUxQ8g=; b=NYxbsGFbj4RWF4r0OxeoLnVR/UTTfBcxKYJM2rPfwDco446KzatETEqA3+uvRt+aLS pJSNgOnw66X0qKtYm82GPkB5JOsGJSGSbeWg9Gns1BdxwCnRUEB8BBugI5V+uD7VhWUF cEN6V3PiM1yAQ5vIBUwgCpNCI6TJ+LfuLa9rI6xdj0+wvzhgSuq6LdWZefVJhG3FHZAh ENOv/Df14nQWUw9UpVEl2m+k7poQcxzLXquKJr6wDRUuLh1ZgWou67x9CZ5GeKiUvJPD qPpak1n7jEEQlrg9ur5ZGIN9uKIQojwW/bKCc+jFccBpj1zNGtqGaartQu4rUQwAR8qU vTig== X-Forwarded-Encrypted: i=1; AJvYcCViTYbCbUM7reEbRorr6u+UBLrg4fNWKeioVAKFV6hdzzdzcZIkVaqxljBaigkcjCqz7p8QlmPFBpvA@lists.postgresql.org X-Gm-Message-State: AOJu0YwyZaHWdVviQh8+sCoCnAlpd6MdWSXhvbitc9OaO1LnPsvMgcho fgXyGMdFmEOts1NN0OoMfS8USJl4ONr0xfLFFl+tHhlF5ZyDHUq+G/4jieXLT84Sb3QbZbtCGsl Lqyi8EX6TIp4+jC2IGRhM5mU+JnPzst3XhRIi4rIe X-Gm-Gg: AeBDietc0cTF0BOHQST2eSlalYEENnjceTjFCJvD6U2hfK6XAOucWRbR1swrS1PsqaR R9tsNX/a5+5OG7/vpuLURLWtRhTD/T2eTl4K8D6H4OLBzAuTNtT5/b6nHgSkVXYMoS8jmLZec3I LlFjr3Gf2+WbuktjcP4bhvuR9cxh+zofY6gdbTA05QV9T3jrI1ydSLwzq9jjSQVdNHdxsNnYHGa NvPsGx9lhNZ+QdEKZAxV0A51AckF2bvT7UFFy4vwEz2mqbJI5v9l68Lqj+HIY0Q3/R1+zwvvTCe PsRy2xE= X-Received: by 2002:a17:907:3d51:b0:b9b:38d4:2cea with SMTP id a640c23a62f3a-b9d724caa11mr131056966b.23.1775806196036; Fri, 10 Apr 2026 00:29:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fredrik Widlert Date: Fri, 10 Apr 2026 09:29:44 +0200 X-Gm-Features: AQROBzC9kRFrnhuUFXWxYiKy66zphVcpZhvYfUiST8Tmkz7Su9pY8_smfmd_JuU Message-ID: Subject: Re: BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns To: Amit Langote Cc: Junwang Zhao , Matheus Alcantara , pgsql-bugs@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000814538064f161980" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000814538064f161980 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for the very quick fix - it's a great feeling to report a problem and get it fixed this quickly. I can confirm that the fix solves not only the small reproducer but also the original problems I got when trying to install our (large) system on PostgreSQL 19 devel for testing. We actually ran into the same problem in two ways: * the reordered FK with datatype mismatch (my reproducer) * other reordered FKs with the same datatypes, where we instead got regular FK violations In case you want a reproducer for the second case as well, I've included it below, but perhaps it's not relevant since the patch already fixed it. ---- drop table if exists parent, child; create table parent ( c1 integer, c2 integer, primary key (c1, c2) ); create table child ( c1 integer, c2 integer, constraint child_fk foreign key (c2, c1) references parent (c2, c1) ); insert into parent (c1, c2) values (1, 2); insert into child (c1, c2) values (1, 2); /Fredrik Widlert On Fri, Apr 10, 2026 at 8:32=E2=80=AFAM Amit Langote wrote: > On Fri, Apr 10, 2026 at 1:42=E2=80=AFPM Amit Langote > wrote: > > Thanks Junwang for checking. I've just pushed this: 980c1a85d819. > > Pushed a follow up commit to add an Assert making the single-column > invariant explicit in ri_FastPathFlushArray(), per Junwang's > suggestion off-list. > > -- > Thanks, Amit Langote > --000000000000814538064f161980 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for the very quick fix - it's a great feeling t= o report a problem
and get it fixed this quickly.

I can confirm t= hat the fix solves not only the small reproducer but also
the original p= roblems I got when trying to install our (large) system
on PostgreSQL 19= devel for testing.

We actually ran into the same problem in two way= s:
* the reordered FK with datatype mismatch (my reproducer)
* other = reordered FKs with the same datatypes, where we instead got
=C2=A0 regul= ar FK violations

In case you want a reproducer for the second case a= s well, I've included it below,
but perhaps it's not relevant si= nce the patch already fixed it.

----
drop table if exists parent,= child;

create table parent (
=C2=A0 =C2=A0 =C2=A0c1 integer,
= =C2=A0 =C2=A0 =C2=A0c2 integer,
=C2=A0 =C2=A0 =C2=A0primary key (c1, c2)=
);

create table child (
=C2=A0 =C2=A0 =C2=A0c1 integer,
= =C2=A0 =C2=A0 =C2=A0c2 integer,
=C2=A0 =C2=A0 =C2=A0constraint child_fk = foreign key (c2, c1) references parent (c2, c1)
);

insert into pa= rent (c1, c2) values (1, 2);
insert into child (c1, c2) values (1, 2);
/Fredrik Widlert

On Fri, Apr 10, 2026 at 8:32=E2= =80=AFAM Amit Langote <amitla= ngote09@gmail.com> wrote:
On Fri, Apr 10, 2026 at 1:42=E2=80=AFPM Amit Langote <<= a href=3D"mailto:amitlangote09@gmail.com" target=3D"_blank">amitlangote09@g= mail.com> wrote:
> Thanks Junwang for checking.=C2=A0 I've just pushed this: 980c1a85= d819.

Pushed a follow up commit to add an Assert making the single-column
invariant explicit in ri_FastPathFlushArray(), per Junwang's
suggestion off-list.

--
Thanks, Amit Langote
--000000000000814538064f161980--