Re: Missing SELECT output on btree_gin char, BTLess* strategy

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Jason Kim <git(at)jasonk(dot)me>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Missing SELECT output on btree_gin char, BTLess* strategy
Date: 2021-08-10 17:14:07
Message-ID: 3821851.1628615647@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Peter Geoghegan <pg(at)bowt(dot)ie> writes:
> On Mon, Aug 9, 2021 at 6:15 PM Jason Kim <git(at)jasonk(dot)me> wrote:
>> The expected output in contrib/btree_gin/expected/char.out is wrong for the
>> first two SELECTs using the BTLess* strategies: they should not be empty.

> Isn't this index corruption, or at least an inconsistent opclass?

Indeed. After a bit of poking around, I realized that btree_gin's
leftmostvalue_char() is not on the same page as btcharcmp() about
whether type "char" is signed or unsigned.

AFAICT, only the latter function matters while making index entries,
while the wrong value from leftmostvalue_char() affects only search
results. So we can just fix it, as attached.

regards, tom lane

Attachment Content-Type Size
btree_gin-is-wrong-about-char-signedness.patch text/x-diff 969 bytes

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kacey Holston 2021-08-10 18:28:49 Re: Issue with logical replication
Previous Message Tom Lane 2021-08-10 17:07:53 Re: Postgres 9.2.13 on AIX 7.1