pgsql: Fix plan cache issue in PL/pgSQL CALL

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix plan cache issue in PL/pgSQL CALL
Date: 2018-04-05 18:56:23
Message-ID: E1f4A3b-0004FQ-0m@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)stehule(at)gmail(dot)com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b9986551e0c6129300b9d7a387baf2006724b297

Modified Files
--------------
src/pl/plpgsql/src/expected/plpgsql_call.out | 10 ++++++++++
src/pl/plpgsql/src/pl_exec.c | 30 ++++++++++++++++++++++++----
src/pl/plpgsql/src/sql/plpgsql_call.sql | 4 ++++
3 files changed, 40 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2018-04-05 19:10:25 pgsql: Allow cpluspluscheck to pass by renaming variable
Previous Message Andres Freund 2018-04-05 18:19:51 Re: pgsql: New files for MERGE