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

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Tomas Vondra <tv(at)fuzzy(dot)cz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Can rs_cindex be < 0 for bitmap heap scans?
Date: 2024-10-25 14:29:09
Message-ID: CAAKRu_ZxF8cDCM_BFi_L-t=RjdCZYP1usd1Gd45mjHfZxm0nZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 24, 2024 at 9:40 AM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> On Thu, Oct 24, 2024 at 12:50 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> >
> > On Thu, Oct 24, 2024 at 3:45 AM Melanie Plageman <melanieplageman(at)gmail(dot)com> wrote:
> >>
> >> HeapScanDescData->rs_cindex (the current index into the array of
> >> visible tuples stored in the heap scan descriptor) is used for
> >> multiple scan types, but for bitmap heap scans, AFAICT, it should
> >> never be < 0.
> >
> > You are right it can never be < 0 in this case at least.
>
> Cool, thanks for confirming. I will commit this change then.

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.

- Melanie

Attachment Content-Type Size
v2-0001-Make-rs_cindex-and-rs_ntuples-unsigned.patch text/x-patch 3.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2024-10-25 15:14:19 Re: Trigger more frequent autovacuums of heavy insert tables
Previous Message jian he 2024-10-25 14:26:48 Re: altering a column's collation leaves an invalid foreign key