Re: Fix incorrect assertion in heapgettup_pagemode()

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, cca5507 <cca5507(at)qq(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix incorrect assertion in heapgettup_pagemode()
Date: 2026-01-05 09:53:41
Message-ID: 67f8d319-3f61-42d6-9051-39acd2b37d4b@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25/12/2025 15:34, Chao Li wrote:
>> On Dec 25, 2025, at 19:13, cca5507 <cca5507(at)qq(dot)com> wrote:
>> diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
>> index 469397e7344..1229e22e78a 100644
>> --- a/src/backend/access/heap/heapam.c
>> +++ b/src/backend/access/heap/heapam.c
>> @@ -1077,7 +1077,7 @@ continue_page:
>> ItemId lpp;
>> OffsetNumber lineoff;
>>
>> - Assert(lineindex <= scan->rs_ntuples);
>> + Assert(lineindex < scan->rs_ntuples);
>> lineoff = scan->rs_vistuples[lineindex];
>> lpp = PageGetItemId(page, lineoff);
>> Assert(ItemIdIsNormal(lpp));
>>
>> The lineindex is 0-based, so it should be '<' rather than '<=', thoughts?
>>
>> --
>> Regards,
>> ChangAo Chen
>> <v1-0001-Fix-incorrect-assertion-in-heapgettup_pagemode.patch>
>
> Good catch. The function comment clearly mentions that lineindex is 0 based.
> ...
> So, the fix looks correct.

Committed, thanks!

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2026-01-05 10:03:48 Re: Can we remove support for standard_conforming_strings = off yet?
Previous Message shveta malik 2026-01-05 09:45:08 Re: [Patch] add new parameter to pg_replication_origin_session_setup