Re: file_fdw: Fix ANALYZE crashes with DEFAULT markers

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ayoub Kazar <ayoub(dot)kazar(at)data-bene(dot)io>
Subject: Re: file_fdw: Fix ANALYZE crashes with DEFAULT markers
Date: 2026-11-05 07:50:13
Message-ID: 9CC436F3-EE34-4C14-80C7-A7B2FEF8D272@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Nov 4, 2026, at 23:26, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
>
> On 04/11/2026 14:37, Fujii Masao wrote:
>> Yeah, since AFAICT there seems no need to invoke registered callbacks,
>> ResetExprContext() might be sufficient. Also, ResetPerTupleExprContext()
>> would be better for consistency with CopyFrom(), which uses it?
>>
>
>
> IIUC es_per_tuple_exprcontext will always be non-NULL because of
> GetPerTupleExprContext(), so in theory the extra check in
> ResetPerTupleExprContext() is a bit redundant, but I agree it's a good
> idea to keep the code consistent.
>
> Thanks!
>
> Best, Jim
>

CopyFrom() does this combination:
```
ResetPerTupleExprContext(estate);

MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
```

So, if we use ResetPerTupleExprContext(estate), then MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory); should be changed accordingly. I think Ayoub commented the same thing.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Michael Paquier 2026-11-05 07:48:04 Re: Report buffer access strategies in EXPLAIN