BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns - Mailing list pgsql-bugs

From Fredrik Widlert
Subject BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns
Date
Msg-id CADfhSr-pCkbDxmiOVYSAGE5QGjsQ48KKH_W424SPk+pwzKZFaQ@mail.gmail.com
Whole thread Raw
Responses Re: BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: surya poondla
Date:
Subject: Re: BUG #19382: Server crash at __nss_database_lookup
Next
From: Matheus Alcantara
Date:
Subject: Re: BUG: PostgreSQL 19devel throws internal opfamily error for FK with reordered referenced columns