summaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpy_exec.c
diff options
context:
space:
mode:
authorKevin Grittner <kgrittn@postgresql.org>2017-04-04 18:36:39 -0500
committerKevin Grittner <kgrittn@postgresql.org>2017-04-04 18:36:39 -0500
commit5ebeb579b9b281dba5f8415b2fbda86fdae7b366 (patch)
tree66aac432d4acc7300f2b395e4c8282f75d53ef0a /src/pl/plpython/plpy_exec.c
parent9a3215026bd6955e88bd8c20542cfe6acffdb1c8 (diff)
Follow-on cleanup for the transition table patch.
Commit 59702716 added transition table support to PL/pgsql so that SQL queries in trigger functions could access those transient tables. In order to provide the same level of support for PL/perl, PL/python and PL/tcl, refactor the relevant code into a new function SPI_register_trigger_data. Call the new function in the trigger handler of all four PLs, and document it as a public SPI function so that authors of out-of-tree PLs can do the same. Also get rid of a second QueryEnvironment object that was maintained by PL/pgsql. That was previously used to deal with cursors, but the same approach wasn't appropriate for PLs that are less tangled up with core code. Instead, have SPI_cursor_open install the connection's current QueryEnvironment, as already happens for SPI_execute_plan. While in the docs, remove the note that transition tables were only supported in C and PL/pgSQL triggers, and correct some ommissions. Thomas Munro with some work by Kevin Grittner (mostly docs)
Diffstat (limited to 'src/pl/plpython/plpy_exec.c')
-rw-r--r--src/pl/plpython/plpy_exec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c
index 697a0e1cc03..7ccd2c82352 100644
--- a/src/pl/plpython/plpy_exec.c
+++ b/src/pl/plpython/plpy_exec.c
@@ -345,6 +345,11 @@ PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc)
PG_TRY();
{
+ int rc PG_USED_FOR_ASSERTS_ONLY;
+
+ rc = SPI_register_trigger_data(tdata);
+ Assert(rc >= 0);
+
plargs = PLy_trigger_build_args(fcinfo, proc, &rv);
plrv = PLy_procedure_call(proc, "TD", plargs);