Re: BUG #19749: bpchar_ops declares equalimage although bpchar equality ignores trailing spaces

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: kehan5800(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19749: bpchar_ops declares equalimage although bpchar equality ignores trailing spaces
Date: 2026-10-06 03:39:32
Message-ID: CAH2-Wzny69e7CZMNMKvu+1vOW-OrLAa5JK-y9i+yED7dUkJX8g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Oct 5, 2026 at 7:45 AM PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
> Expected: bpchar_ops does not claim equalimage, or CREATE INDEX on bpchar
> does not violate the nbtree invariant.
>
> Actual: allequalimage is set for bpchar indexes, and an assert-enabled
> server aborts on CREATE INDEX with equal-but-differently-padded values.

Oops.

> Suggested fix (the same as for interval_ops): drop the amprocnum 4 entry
> for btree/bpchar_ops from pg_amproc.dat (catversion bump). As with
> interval_ops, existing indexes keep the allequalimage flag in their
> metapage, so a REINDEX note would be needed if back-patched. A
> typmod-dependent answer is not possible, since equalimage is called per
> opclass and collation, not per column.

That sounds like the right approach.

--
Peter Geoghegan

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Tom Lane 2026-10-06 00:41:47 Re: Spurious curly bracket in "CREATE FUNCTION"/"CREATE PROCEDURE" doc