Re: pgsql: Specialize tuplesort routines for different kinds of abbreviated

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: John Naylor <john(dot)naylor(at)postgresql(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: pgsql: Specialize tuplesort routines for different kinds of abbreviated
Date: 2022-05-10 09:44:50
Message-ID: CAFBsxsEE3i+_AcQuXdX62+v9JyQ5wvEFDBOdDMnDSdAdR4_Txw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Tue, May 10, 2022 at 3:46 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:

> I was just looking over this change and wondered a few things:
>
> 1. Shouldn't ssup_datum_signed_cmp and ssup_datum_int32_cmp be using
> DatumGetInt32 and DatumGetInt64?

Right.

> This is hypothetical, but if for some reason SIZEOF_VOIDP was larger
> than 8, say 16, then the above would define USE_FLOAT8_BYVAL resulting
> timestamp and bigint using the new comparators. However, the code
> you've added to ssup_datum_signed_cmp checks for SIZEOF_DATUM == 8. It
> would assume 32-bit accidentally. That would cause issues.

Testing for Datum size seems more in line with the intent. (Even aside
from that hypothetical, making all Datums 8 bytes has been suggested
before, and this might make that change easier.)

> From what I can see, ssup_datum_signed_cmp just shouldn't exist in
> 32-bit builds and we should be consistent about how we determine when
> comparators to use.
>
> I've attached a patch which is along the lines of how I imagined this
> should look.
>
> What do you think?

+1

--
John Naylor
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2022-05-10 15:35:48 pgsql: doc: first draft of PG 15 release notes
Previous Message David Rowley 2022-05-10 08:46:29 Re: pgsql: Specialize tuplesort routines for different kinds of abbreviated