Follow-on cleanup for the transition table patch.
Kevin Grittner <kgrittn@postgresql.org>
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)
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/ref/create_trigger.sgml | modified | +5 −5 |
| doc/src/sgml/spi.sgml | modified | +125 −0 |
| doc/src/sgml/trigger.sgml | modified | +46 −8 |
| src/backend/executor/spi.c | modified | +52 −0 |
| src/include/executor/spi.h | modified | +3 −0 |
| src/pl/plperl/expected/plperl_trigger.out | modified | +29 −0 |
| src/pl/plperl/plperl.c | modified | +7 −0 |
| src/pl/plperl/sql/plperl_trigger.sql | modified | +32 −0 |
| src/pl/plpgsql/src/pl_exec.c | modified | +3 −46 |
| src/pl/plpgsql/src/plpgsql.h | modified | +0 −4 |
| src/pl/plpython/expected/plpython_trigger.out | modified | +21 −0 |
| src/pl/plpython/plpy_exec.c | modified | +5 −0 |
| src/pl/plpython/sql/plpython_trigger.sql | modified | +24 −0 |
| src/pl/tcl/expected/pltcl_queries.out | modified | +21 −0 |
| src/pl/tcl/pltcl.c | modified | +5 −0 |
| src/pl/tcl/sql/pltcl_queries.sql | modified | +20 −0 |