Re: pgsql: Generalize hash and ordering support in amapi

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Generalize hash and ordering support in amapi
Date: 2025-03-01 08:23:57
Message-ID: 5cc4192a-7c28-4a69-a879-477b5ece600c@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 27.02.25 23:17, Mark Dilger wrote:
>
> On Thu, Feb 27, 2025 at 8:27 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
> <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
>
> Peter Eisentraut <peter(at)eisentraut(dot)org
> <mailto:peter(at)eisentraut(dot)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.

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-03-01 19:23:23 pgsql: Fix pg_strtof() to not crash on NULL endptr.
Previous Message Peter Eisentraut 2025-03-01 08:23:28 pgsql: Set amcancrosscompare to true for hash