Re: pgsql: Generalize hash and ordering support in amapi - Mailing list pgsql-committers

From Peter Eisentraut
Subject Re: pgsql: Generalize hash and ordering support in amapi
Date
Msg-id 5cc4192a-7c28-4a69-a879-477b5ece600c@eisentraut.org
Whole thread Raw
In response to Re: pgsql: Generalize hash and ordering support in amapi  (Mark Dilger <mark.dilger@enterprisedb.com>)
List pgsql-committers
On 27.02.25 23:17, Mark Dilger wrote:
> 
> On Thu, Feb 27, 2025 at 8:27 AM Tom Lane <tgl@sss.pgh.pa.us 
> <mailto:tgl@sss.pgh.pa.us>> wrote:
> 
>     Peter Eisentraut <peter@eisentraut.org
>     <mailto:peter@eisentraut.org>> writes:
>      > Generalize hash and ordering support in amapi
>      > Stop comparing access method OID values against HASH_AM_OID and
>      > BTREE_AM_OID, and instead check the IndexAmRoutine for an index
>     to see
>      > if it advertises its ability to perform the necessary ordering,
>      > hashing, or cross-type comparing functionality.  A field amcanorder
>      > already existed, this uses it more widely.  Fields amcanhash and
>      > amcancrosscompare are added for the other purposes.
> 
>     AFAICS, this patch sets amcancrosscompare true only for btree,
>     which means this change to equality_ops_are_compatible is surely wrong:
> 
>     -       /* must be btree or hash */
>     -       if (op_form->amopmethod == BTREE_AM_OID ||
>     -           op_form->amopmethod == HASH_AM_OID)
>     +       if (amroutine->amcancrosscompare)
> 
> 
> It seems you are right.  hashhandler()'s amroutine should have this 
> true, also.

I have fixed that.  I will come back to the rest of the discussion in a bit.




pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Set amcancrosscompare to true for hash
Next
From: Tom Lane
Date:
Subject: pgsql: Fix pg_strtof() to not crash on NULL endptr.