Re: Streaming decoding fails with "unexpected table_index_fetch_tuple call during logical decoding" when a relation has a TOASTed conbin (follow-up to BUG #18641)

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, Jiří Kavalík <jiri(dot)kavalik(at)comgate(dot)cz>, Zhijie Hou <houzhijie22(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Streaming decoding fails with "unexpected table_index_fetch_tuple call during logical decoding" when a relation has a TOASTed conbin (follow-up to BUG #18641)
Date: 2026-10-28 08:41:05
Message-ID: 43C69397-4F56-4B93-ADEA-DF4EFEC7E00B@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Oct 27, 2026, at 14:42, Hayato Kuroda (Fujitsu) <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Hi Peter,
>
>> Since you are refactoring this flag anyway, would it be better to try
>> to eliminate the global-variable completely? e.g. expose the same
>> information by some accessor function.
>>
>> -extern PGDLLIMPORT bool bsysscan;
>> +extern PGDLLIMPORT int sysscan_depth;
>
> Good point, it can be removed by providing few functions. v5 did the same.
> We need to keep bsysscan anyway for back branches, so the patch shape for them
> is slightly different, see v5-PG18.
>
> Best regards,
> Hayato Kuroda
> FUJITSU LIMITED
>
> <v5-0001-Track-the-depth-of-scans-of-system-tables.patch><nocfbot-v5-PG18-0001-Track-the-depth-of-scans-of-system-tables.patch><nocfbot-v5-PG19-0001-Track-the-depth-of-scans-of-system-tables.patch>

Hi Hayato,

I agree with the solution. However, I have a minor concern about the naming. BeginSystemTableScan() and EndSystemTableScan() sound like functions that actually start and end system table scans, whereas they only track sysscan_depth. How about renaming them to TrackSystemTableScanStart() and TrackSystemTableScanEnd() to better reflect their purpose?

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Henson Choi 2026-10-28 05:48:23 Re: BUG #19732: first_value/last_value/nth_value return NULL with EXCLUDE TIES when the current row is outside its f