| From: | Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | CachedPlan Invalidation in SQL function |
| Date: | 2026-11-17 18:07:14 |
| Message-ID: | bdbc235ae2b3c2e75916c12e9da5e2fd@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi.
We've found one exotic case with SQL function plan invalidation. The
case is arguably valid in itself, but I think it shows existing issue in
init_execution_state(). To get function result tlist
init_execution_state() looks at plansource->query_list. But if
plansource was invalidated, query_list is NULL, so we can't look at it.
As for the test case, it uses immutable function to modify table, used
in SQL function during execution of query simplification logic.
The possible fix is attached, but I'm not sure that I like it as we
always pay for this case by copying query tree to the plan context.
--
Best regards,
Alexander Pyhalov,
Postgres Professional
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-init_execution_state-shouldn-t-suppose-that-plansour.patch | text/x-diff | 4.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2026-11-17 18:26:24 | Re: Assertion failure in update_local_synced_slot(), slotsync.c:364 |
| Previous Message | Maksim.Melnikov | 2026-11-17 18:04:48 | Re: Infinite loop in XLogPageRead() on standby |