On 18 Sep 2025, at 15:36, Mark Dilger <mark.dilger@enterprisedb.com> wrote:
>
> Testing with the src/test/modules/treeb work in the patch series at [1], modifying treebcanreturn() to always return
falseand modifying _treeb_first(), _treeb_next(), and _treeb_endpoint() to set scan->xs_itup to NULL rather than to a
tuple,without the patch there are a number of test failures with "ERROR: no data returned for index-only scan", but
withthe patch applied those errors still appear. They are raised by nodeIndexonlyscan.c at line 213, inside
IndexOnlyNext(),suggesting that changing treebcanreturn() to return false was not enough to dissuade the planner from
choosingthe index for an index only scan.
>
> Is there a bug in how the system selects an index for an index-only scan? Or is the combination amcanorder=true &&
amcanreturn=NULL/falsenot a valid choice for an index? If the latter, shouldn't there be a check for that somewhere,
orat least an Assert()?
After a short offline discussion with Mark, we determined that this issue was due to treebproperty still returning true
forthe AMPROP_RETURNABLE property. This was a small oversight in the testing, but does not indicate a bug in postgres.