]> granicus.if.org Git - postgresql/commit
Need to do SPI_push/SPI_pop around expression evaluation in plpgsql.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Nov 2016 17:09:36 +0000 (12:09 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Nov 2016 17:09:36 +0000 (12:09 -0500)
commita5b153ff51945034467adbfef1aa0e8f8c1e3267
tree4378d310972dd46f94d002a29152dc75d6e9504d
parent20559a854662e6beb4864fc8125cb6401d8b07fa
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.1387.66380@wrigleys.postgresql.org>
src/pl/plpgsql/src/pl_exec.c
src/test/regress/expected/plpgsql.out
src/test/regress/sql/plpgsql.sql