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 1wArI9-000TAj-2v for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Apr 2026 15:27:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wArI8-006Q3a-0V for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Apr 2026 15:27:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wArI7-006Q3S-23 for pgsql-bugs@lists.postgresql.org; Thu, 09 Apr 2026 15:27:36 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wArI5-00000000BT3-3yN2 for pgsql-bugs@lists.postgresql.org; Thu, 09 Apr 2026 15:27:35 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-66bf6aa4858so1813654a12.2 for ; Thu, 09 Apr 2026 08:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775748451; cv=none; d=google.com; s=arc-20240605; b=W9VSi4ujJz5IWiLt1owCtduwsB7kMpwhUvBuk1yPyaLcpay/1xEZ0Z1tGCU5B80qe5 5ciJlMv64cbEN7Ap8C/83/b4Tkhqy208RU3TaweunT8PO1ym21/lHFlwgpTRPHpLy2zr FSmA2f7vXYzurog3k0LBhc8adNWhFxjQ8m/tnzP+S2Y4SFQBGxjm1v8RO9WL/I941zzY 3rZkv7bYBvB0u/RtGS3Dc1T5h4OI4tZnglFQJLzkYOPuC7LUqpk6HDJFX5bLvC1D/LG6 mYU7HRAcCLlcaLIWeQJD5glL90QSPCoif4ajMB5QUKlGX+vPgiGgiEyLMqPNevb+HG7O yscg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=v1lqOStjEcqFpHPkixV8uEGgVSyPQEzsdQ+uNcRJWIw=; fh=/gQe77b11iMZdcPj/nJr/Ghqi6rQp5FPrPbdO93bmOA=; b=Yx5jgKItY566IJThRMaS/nJmc83tkj6mExIELd1XehZ00y5lzxfh2jhqO7wFjFWMCc KfnvYXqda4YzS/yM+t8oH5awW2ztWc7lq9tuU5clNTsWGWKSkIAH30eBBEJ2/gx2fuCk adhqCUlf7pfc0ucY8zvw6HWDyBa+U/vZaEdrbq4K8bW6jS7cAj/a3kteqFBN+mw0QqYN +6v/sRWFXceweeBPFNnNYGQ1U9UZlSJ9KFRkHp73zvC3HoZY4WRJw5R09U1ji7HrjJ7b zcjuiTdGQ65nw0fKKst8VG0TbK1LuDZSQl1yRnNkOYY3ECKe21rZhQjFWQPJw2obirze K76g==; 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=1775748451; x=1776353251; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=v1lqOStjEcqFpHPkixV8uEGgVSyPQEzsdQ+uNcRJWIw=; b=zAdzrWfwEpTgsu16/pJRWMC9yfinLMw15Hbpqs9Pfy+Jsn/zw5ncBwJr1va9qBTr9J u7VTOs95uOhqe/KlIZwank86VsH+vNWj1Ma5RZLGCN10j0/Ahue1Wig714VuMsOJMwzx ssLMYbjwXrTFKrZq6aMb/sghSN3zMw726A/djkEvXhvFUimwf/1sHRYnYY6vlQdtaCkl 2Mwm1iyKYOy5IcEg+VnAQjrltIqJRDnqr01qdicKj/QQEJYQDfb6Td8DDSfXlYzJ/uCl eH7Q4mlc2Noc+opb67AJ8LHP/Qud48w8SwYPJxGNA6EPgPGs/LWS44WIqf/Hsya3e7qu EkDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775748451; x=1776353251; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=v1lqOStjEcqFpHPkixV8uEGgVSyPQEzsdQ+uNcRJWIw=; b=Y5l1S0x6Wa50bLt8cwKLy97Q0YA6bWi2GwwQkjja+sqaa1gJ46a0x/+Z2StCWoM8Hl GuN+i1s4ZG6YJCJ7ZBRSWQeuT8HFWlwBdNt6IQL149mckj7RQB7+jRwZLjBcmiHfwfXF x9zmex0tYXDEK8YSGBkIiXzityTnGz1mpoSS3LKXQo9F+qpPd36Z5jYN46JTXxxCx7Sq G134lVwoRMaUnTSjFfqhf889SGpv/OiT7AO2P/WZ9pnpCqHcvyD9ljwzbQc3ewF4le0c iR+6am0sPCjLzbUZZWSo1m9GbUPIYEwRl6RRs2Ky9TsRo2nuXSxvFjgUlvd34sQtmq4f OIkA== X-Gm-Message-State: AOJu0Yy70Sy6QE73sFfBy3Ianc/fgnLHV3UPB04peAJOyZFoTU3aL1q4 pyAD1H7qRq+CCk0MWHVPkGEtW7OYic7y4nhrEvamFObz+4zaypIDoLCEnZsGjLgD/oBlhqHD/Ge i+INU+zZgBT2fLC7ODrFcZpRb6XJ6hqeYue1AxhsZc5OwHiKksd32Kw== X-Gm-Gg: AeBDieuoHUixccATap8b/Q+5T43GMm8dwQc1dQaLF600vevGmQTrI86kB6/pbK4KP8U paY1HOKNIyU0U949Wg2j6fc7i+H0spPWkomolUoRuGL+VKOobLQ4D7fQgmmFXry9gn/hA7WLu9t mWAZp4ohqMcRtsvhpnjDP16iC/Jb4ZzQVhp0RvyoK2xkGrc0zCRe4Qg1vjgzOc3zgLgO40lwpb9 Rdj2JgbOrCzE0WDW5QBiIjNZF0rPD3ABHpoovrzJ+lpoCTR48W8/MB0uoei+VWdQVkriDfpry7N gNrqcfk= X-Received: by 2002:a17:907:cf87:b0:b9c:36a1:d32a with SMTP id a640c23a62f3a-b9d476db233mr235737366b.48.1775748450993; Thu, 09 Apr 2026 08:27:30 -0700 (PDT) MIME-Version: 1.0 From: Fredrik Widlert Date: Thu, 9 Apr 2026 17:27:19 +0200 X-Gm-Features: AQROBzBC1sI8qWpS2WPsZdvLF5nhbGcHDflabWOqUTrquafhSrNZgbMKSSx4A5M Message-ID: Subject: BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns To: pgsql-bugs@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000a1e75d064f08a73f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a1e75d064f08a73f Content-Type: text/plain; charset="UTF-8" Hello, I believe I may have found a regression in PostgreSQL 19devel, downloaded on 2026-04-09 from https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.gz. postgres=# select version(); version ----------------------------------------------------------------------------------------------------- PostgreSQL 19devel on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0, 64-bit With the reproducer below, PostgreSQL 18 reports a normal foreign-key violation at INSERT time, but PostgreSQL 19devel instead throws an internal-looking error: ERROR: operator 98 is not a member of opfamily 1976 -- reproducer: drop table if exists parent, child; create table parent ( app_id varchar(256) not null, report_id smallint not null, otype integer not null, subtype integer not null, ctype integer not null, column_name varchar(30) not null, primary key (app_id, report_id, otype, subtype, ctype, column_name) ); create table child ( app_id varchar(256) not null, report_id smallint not null, otype integer not null, subtype integer not null, column_name varchar(30) not null, ctype integer, -- intentionally swapped: column_name, ctype constraint child_fk foreign key (app_id, report_id, otype, subtype, column_name, ctype) references parent (app_id, report_id, otype, subtype, column_name, ctype) ); -- trigger the problem insert into child (app_id, report_id, otype, subtype, column_name, ctype) values ('DEFAULT_APP', 0, -1, -1, 'ID', -1); /Fredrik Widlert fredrik.widlert@digpro.se --000000000000a1e75d064f08a73f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I believe I may have found a regression in P= ostgreSQL 19devel, downloaded on 2026-04-09
from https://ftp.pos= tgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.gz.

postgre= s=3D# select version();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0version
-------------------= ---------------------------------------------------------------------------= -------
=C2=A0PostgreSQL 19devel on x86_64-pc-linux-gnu, compiled by gcc= (Ubuntu 13.2.0-23ubuntu4) 13.2.0, 64-bit


With the reproducer be= low, PostgreSQL 18 reports a normal foreign-key violation
at INSERT time= , but PostgreSQL 19devel instead throws an internal-looking error:

E= RROR: =C2=A0operator 98 is not a member of opfamily 1976



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

create table pare= nt (
=C2=A0 =C2=A0 app_id =C2=A0 =C2=A0 =C2=A0varchar(256) not null,
= =C2=A0 =C2=A0 report_id =C2=A0 smallint =C2=A0 =C2=A0 not null,
=C2=A0 = =C2=A0 otype =C2=A0 =C2=A0 =C2=A0 integer =C2=A0 =C2=A0 =C2=A0not null,
= =C2=A0 =C2=A0 subtype =C2=A0 =C2=A0 integer =C2=A0 =C2=A0 =C2=A0not null,=C2=A0 =C2=A0 ctype =C2=A0 =C2=A0 =C2=A0 integer =C2=A0 =C2=A0 =C2=A0not = null,
=C2=A0 =C2=A0 column_name varchar(30) =C2=A0not null,
=C2=A0 = =C2=A0 primary key (app_id, report_id, otype, subtype, ctype, column_name)<= br>);

create table child (
=C2=A0 =C2=A0 app_id =C2=A0 =C2=A0 =C2= =A0varchar(256) not null,
=C2=A0 =C2=A0 report_id =C2=A0 smallint =C2=A0= =C2=A0 not null,
=C2=A0 =C2=A0 otype =C2=A0 =C2=A0 =C2=A0 integer =C2= =A0 =C2=A0 =C2=A0not null,
=C2=A0 =C2=A0 subtype =C2=A0 =C2=A0 integer = =C2=A0 =C2=A0 =C2=A0not null,
=C2=A0 =C2=A0 column_name varchar(30) =C2= =A0not null,
=C2=A0 =C2=A0 ctype =C2=A0 =C2=A0 =C2=A0 integer,
=C2=A0= =C2=A0 -- intentionally swapped: column_name, ctype
=C2=A0 =C2=A0 const= raint child_fk
=C2=A0 =C2=A0 =C2=A0 foreign key (app_id, report_id, otyp= e, subtype, column_name, ctype)
=C2=A0 =C2=A0 =C2=A0 references parent (= app_id, report_id, otype, subtype, column_name, ctype)
);


-- = trigger the problem
insert into child (app_id, report_id, otype, subtype= , column_name, ctype)
values ('DEFAULT_APP', 0, -1, -1, 'ID&= #39;, -1);


/Fredrik Widlert
--000000000000a1e75d064f08a73f--