Fix plan cache issue in PL/pgSQL CALL
Peter Eisentraut <peter_e@gmx.net>
Fix plan cache issue in PL/pgSQL CALL If we are not going to save the plan, then we need to unset expr->plan after we are done, also in error cases. Otherwise, we get a dangling pointer next time around. This is not the ideal solution. It would be better if we could convince SPI not to associate a cached plan with a resource owner, and then we could just save the plan in all cases. But that would require bigger surgery. Reported-by: Pavel Stehule <pavel.stehule@gmail.com>
Files
| Path | Change | +/− |
|---|---|---|
| src/pl/plpgsql/src/expected/plpgsql_call.out | modified | +10 −0 |
| src/pl/plpgsql/src/pl_exec.c | modified | +26 −4 |
| src/pl/plpgsql/src/sql/plpgsql_call.sql | modified | +4 −0 |