Re: btoidsortsupport issue

From: John Naylor <johncnaylorls(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: btoidsortsupport issue
Date: 2026-08-10 10:44:10
Message-ID: CANWCAZYcMkg3yrtUctYT+AVMH=2BFav7rqFAbaT=uWcHNi8yeA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 10, 2026 at 4:07 AM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> On Mon, 10 Aug 2026 at 08:19, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> > btoidsortsupport() uses ssup_datum_unsigned_cmp() at that commit,
> > which compares all 64 bits of each Datum. The test case shows that the
> > same oid value can reach the comparator with the extraneous bits
> > filled two different ways. Tuple deformation sign-extends every 4-byte
> > pass-by-value attribute (see fetch_att() and friends), whereas
> > ObjectIdGetDatum() zero-extends instead. This inconsistency makes
> > their datums incompatible for ssup_datum_unsigned_cmp's purposes,
> > leading to wrong answers in certain narrow cases.
>
> This seems to be a duplicate of [1].
>
> David
>
> [1] https://postgr.es/m/CA+fm-RMyLC94NfrxCh273+dKs44U0ZJjRczznvzvgw=KtpPNVw@mail.gmail.com

For the archives, I've now committed the fix discussed in that thread.
I went ahead and incorporated Peter's regression test since my draft
unnecessarily used a separate temp table

--
John Naylor
Amazon Web Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-08-10 10:45:25 Re: use of SPI by postgresImportForeignStatistics
Previous Message Hannu Krosing 2026-08-10 10:43:37 Re: Support for 8-byte TOAST values, round two