mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Make plperl's $_TD trigger data a global rather than a lexical variable,
with a fresh local value for each invocation, to avoid unexpected sharing violations. Per recent -hackers discussion.
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.53 2006/05/26 17:34:16 adunstan Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.54 2006/05/29 13:51:23 adunstan Exp $ -->
|
||||||
|
|
||||||
<chapter id="plperl">
|
<chapter id="plperl">
|
||||||
<title>PL/Perl - Perl Procedural Language</title>
|
<title>PL/Perl - Perl Procedural Language</title>
|
||||||
@ -660,8 +660,9 @@ $$ LANGUAGE plperl;
|
|||||||
<para>
|
<para>
|
||||||
PL/Perl can be used to write trigger functions. In a trigger function,
|
PL/Perl can be used to write trigger functions. In a trigger function,
|
||||||
the hash reference <varname>$_TD</varname> contains information about the
|
the hash reference <varname>$_TD</varname> contains information about the
|
||||||
current trigger event. The fields of the <varname>$_TD</varname> hash
|
current trigger event. <varname>$_TD</> is a global variable,
|
||||||
reference are:
|
which gets a separate local value for each invocation of the trigger.
|
||||||
|
The fields of the <varname>$_TD</varname> hash reference are:
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* plperl.c - perl as a procedural language for PostgreSQL
|
* plperl.c - perl as a procedural language for PostgreSQL
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.109 2006/05/26 17:34:16 adunstan Exp $
|
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.110 2006/05/29 13:51:23 adunstan Exp $
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -771,7 +771,7 @@ plperl_create_sub(char *s, bool trusted)
|
|||||||
ENTER;
|
ENTER;
|
||||||
SAVETMPS;
|
SAVETMPS;
|
||||||
PUSHMARK(SP);
|
PUSHMARK(SP);
|
||||||
XPUSHs(sv_2mortal(newSVpv("my $_TD=$_[0]; shift;", 0)));
|
XPUSHs(sv_2mortal(newSVpv("our $_TD; local $_TD=$_[0]; shift;", 0)));
|
||||||
XPUSHs(sv_2mortal(newSVpv(s, 0)));
|
XPUSHs(sv_2mortal(newSVpv(s, 0)));
|
||||||
PUTBACK;
|
PUTBACK;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user