CachedPlan Invalidation in SQL function
Started by Alexander Pyhalov5 days ago1 messageshackers
Stepping through
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