pgsql: Need to do SPI_push/SPI_pop around expression evaluation in plpg

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Need to do SPI_push/SPI_pop around expression evaluation in plpg
Date: 2016-11-06 17:09:47
Message-ID: E1c3Qx1-0007DA-RH@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Need to do SPI_push/SPI_pop around expression evaluation in plpgsql.

We must do this in case the expression evaluation results in calling
another plpgsql function (or, really, anything using SPI). I missed
the need for this when I converted exec_cast_value() from doing a
simple InputFunctionCall() to doing ExecEvalExpr() in commit 1345cc67b.
There is a SPI_push_conditional in InputFunctionCall(), so that there
was no bug before that.

Per bug #14414 from Marcos Castedo. Add a regression test based on his
example, which was that a plpgsql function in a domain check constraint
didn't work when assigning to a domain-type variable within plpgsql.

Report: <20161106010947(dot)1387(dot)66380(at)wrigleys(dot)postgresql(dot)org>

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/674877e93a1b9217c692a5671e1118136959ee74

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 4 ++++
src/test/regress/expected/plpgsql.out | 19 +++++++++++++++++++
src/test/regress/sql/plpgsql.sql | 22 ++++++++++++++++++++++
3 files changed, 45 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-11-06 19:43:31 pgsql: Rationalize and document pltcl's handling of magic ".tupno" arra
Previous Message Tom Lane 2016-11-06 16:29:45 pgsql: Fix silly nil-pointer-dereference bug introduced in commit d5f6f