Re: BUG #19749: bpchar_ops declares equalimage although bpchar equality ignores trailing spaces - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: BUG #19749: bpchar_ops declares equalimage although bpchar equality ignores trailing spaces
Date
Msg-id CAH2-Wzny69e7CZMNMKvu+1vOW-OrLAa5JK-y9i+yED7dUkJX8g@mail.gmail.com
Whole thread
In response to BUG #19749: bpchar_ops declares equalimage although bpchar equality ignores trailing spaces  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Mon, Oct 5, 2026 at 7:45 AM PG Bug reporting form
<noreply@postgresql.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



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Spurious curly bracket in "CREATE FUNCTION"/"CREATE PROCEDURE" doc
Next
From: Fujii Masao
Date:
Subject: Re: 42P16 error when dropping and adding column