On 18 Sep 2025, at 15:36, Mark Dilger <mark.dil...@enterprisedb.com> wrote: > > Testing with the src/test/modules/treeb work in the patch series at [1], > modifying treebcanreturn() to always return false and 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 with the > 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 choosing the 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/false not a valid > choice for an index? If the latter, shouldn't there be a check for that > somewhere, or at least an Assert()?
After a short offline discussion with Mark, we determined that this issue was due to treebproperty still returning true for the AMPROP_RETURNABLE property. This was a small oversight in the testing, but does not indicate a bug in postgres.