Hi Jingtang,
The problem is real, and the fix LGTM.
> Passing the flag there seems to require extending the table scan
> interface
Actually, no extension is needed: table_beginscan_common() already
accepts user_flags, so heapam_index_build_range_scan() can simply
call it directly and pass SO_MAINTENANCE.
BRIN's summarize_range() also goes through
heapam_index_build_range_scan(), so fixing the serial path would
switch it over. IMO, that counts as maintenance too.
Best regards,
Yuhang Qiu