I reviewed the patch. Overall it looks fine to me.
One comment,
>- if (index->amcanparallel &&
>- !index_only_scan &&
>+ if ((index->amcanparallel ||
>+ index_only_scan) &&
Why do we need to check for index_only_scan in the above condition. IIUC, index->amcanparallel is necessary for
parallel index scan to be chosen. We cannot chose parallel index only scan if index_only_scan is happening
without worrying about index->amcanparallel value. So OR-ing index->amcanparallel with index_only_scan is probably not
correct.
Thank you,
Rahila Syed