Re: Replace magic numbers with strategy numbers for B-tree indexes

From: Nikita Malakhov <hukutoc(at)gmail(dot)com>
To: Daniil Davydov <3danissimo(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Replace magic numbers with strategy numbers for B-tree indexes
Date: 2025-09-01 08:27:28
Message-ID: CAN-LCVNBk9Tdt8PdUjPGC1hBLgoxL5EX_NEegJpK5OsnBGKeOQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Daniil!

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.

--
Regards,
Nikita Malakhov
Postgres Professional
The Russian Postgres Company
https://postgrespro.ru/

Attachment Content-Type Size
v3-0001-poc-get-rid-of-magic-numbers.patch application/octet-stream 4.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2025-09-01 09:06:35 Re: Adding REPACK [concurrently]
Previous Message Fabrice Chapuis 2025-09-01 07:42:50 Re: Issue with logical replication slot during switchover