1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Add table_name and table_schema to plperl trigger data. relname is

kept but now deprecated. Patch from Adam Sjøgren. Add regression test to
show plperl trigger data (Andrew).
TBD: apply similar changes to plpgsql, plpython and pltcl.
This commit is contained in:
Andrew Dunstan
2006-05-26 17:34:16 +00:00
parent 5d1a066e64
commit 777f72cd37
4 changed files with 176 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.108 2006/04/04 19:35:37 tgl Exp $
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.109 2006/05/26 17:34:16 adunstan Exp $
*
**********************************************************************/
@ -525,6 +525,12 @@ plperl_trigger_build_args(FunctionCallInfo fcinfo)
hv_store(hv, "relname", 7,
newSVpv(SPI_getrelname(tdata->tg_relation), 0), 0);
hv_store(hv, "table_name", 10,
newSVpv(SPI_getrelname(tdata->tg_relation), 0), 0);
hv_store(hv, "table_schema", 12,
newSVpv(SPI_getnspname(tdata->tg_relation), 0), 0);
if (TRIGGER_FIRED_BEFORE(tdata->tg_event))
when = "BEFORE";
else if (TRIGGER_FIRED_AFTER(tdata->tg_event))