Re: BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns

From: Fredrik Widlert <fredrik(dot)widlert(at)digpro(dot)se>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Junwang Zhao <zhjwpku(at)gmail(dot)com>, Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns
Date: 2026-04-10 07:29:44
Message-ID: CADfhSr8hYc-4Cz7vfXH_oV-Jq81pyK9W4phLrOGspovsg2W7Kw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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 AM Amit Langote <amitlangote09(at)gmail(dot)com>
wrote:

> On Fri, Apr 10, 2026 at 1:42 PM Amit Langote <amitlangote09(at)gmail(dot)com>
> 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
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Langote 2026-04-10 08:05:33 Re: BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns
Previous Message Amit Langote 2026-04-10 06:32:31 Re: BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns