On Fri, Oct 25, 2024 at 10:29 AM Melanie Plageman <melanieplageman@gmail.com> wrote: > > Tom suggested off-list that if rs_cindex can't be zero, then it should > be unsigned. I checked the other scan types using the > HeapScanDescData, and it seems none of them use values of rs_cindex or > rs_ntuples < 0. As such, here is a patch making both rs_ntuples and > rs_cindex unsigned.
IMHO we can't make "lineindex" as uint32, because just see the first code block[1] of heapgettup_pagemode(), we use this index as +ve (Forward scan )as well as -ve (Backward scan).
[1]
if (likely(scan->rs_inited)) { /* continue from previously returned page/tuple */ page = BufferGetPage(scan->rs_cbuf);
lineindex = scan->rs_cindex + dir; if (ScanDirectionIsForward(dir))