Re: Replace magic numbers with strategy numbers for B-tree indexes - Mailing list pgsql-hackers

From Daniil Davydov
Subject Re: Replace magic numbers with strategy numbers for B-tree indexes
Date
Msg-id CAJDiXgh9QuLmkGQKA7sh-=4Aqp9_Opmc74X-Kn8BXcxwQsfX9g@mail.gmail.com
Whole thread Raw
In response to Re: Replace magic numbers with strategy numbers for B-tree indexes  (Nikita Malakhov <hukutoc@gmail.com>)
Responses Re: Replace magic numbers with strategy numbers for B-tree indexes
List pgsql-hackers
Hi,

On Mon, Sep 1, 2025 at 3:27 PM Nikita Malakhov <hukutoc@gmail.com> wrote:
>
> Please correct if I'm wrong, but it seems Peter had another approach in mind -
> magic numbers in separate macros could be easily replaced with enums and
> validation functions, which would make code more readable and less 'magical'.
> Please check the POC patch in attach.
> I've made this just for BT strategies macros and touched only 2 source files
> to make a correct but simple example.
>

I don't think that we can just create different enums for each index strategies.
We have (for example) ScanKey functionality, which can work with different
indexes (and such a functions has a uint16 argument for strategy number).

Or are you talking about a single huge enum for all index types? I don't
mind trying to do something like this, but I'm not sure how
"beautiful" it will be.

--
Best regards,
Daniil Davydov



pgsql-hackers by date:

Previous
From: "Euler Taveira"
Date:
Subject: Re: split func.sgml to separated individual sgml files
Next
From: Jacques Combrink
Date:
Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue