[PATCH] Check that index can return in get_actual_variable_range()

From: Maxime Schoemans <maxime(dot)schoemans(at)enterprisedb(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
Subject: [PATCH] Check that index can return in get_actual_variable_range()
Date: 2025-09-17 10:16:44
Message-ID: 20ED852A-C2D9-41EB-8671-8C8B9D418BE9@enterprisedb.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Some recent changes were made to remove the explicit dependency on btree indexes in some parts of the code. One of these changes was made in commit 9ef1851685b, which allows non-btree indexes to be used in get_actual_variable_range(). A follow-up commit ee1ae8b99f9 fixes the cases where an index doesn’t have a sortopfamily as this is a prerequisite to be used in get_actual_variable_range(). However, I found out recently that indices that have ‘amcanorder = true’ but do not allow index-only-scans (amcanreturn returns false or is NULL) will pass all of the conditions, while they should be rejected since get_actual_variable_range() uses the index-only-scan machinery in get_actual_variable_endpoint().

Attached is a small patch that adds a check in get_actual_variable_range() to reject indices that do not allow index-only scans.

Regards,
Maxime Schoemans

Attachment Content-Type Size
v1-0001-Check-that-index-can-return-in-get_actual_variabl.patch application/octet-stream 1.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2025-09-17 10:31:44 Re: Make TID Scans recalculate the TIDs less often
Previous Message Andrey Borodin 2025-09-17 10:13:00 Re: Make TID Scans recalculate the TIDs less often