Re: Can rs_cindex be < 0 for bitmap heap scans?

Melanie Plageman <melanieplageman@gmail.com>

From: Melanie Plageman <melanieplageman@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>, Tomas Vondra <tv@fuzzy.cz>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2024-10-25T16:37:09Z
Lists: pgsql-hackers

Attachments

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.

I realized one of the asserts was superfluous. Please find v3 attached.

- Melanie

Commits

  1. Fix overflow danger in SampleHeapTupleVisible(), take 2

  2. Fix overflow danger in SampleHeapTupleVisible()

  3. Make rs_cindex and rs_ntuples unsigned