Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21e343d

Browse files
committed
Make plperl's $_TD trigger data a global rather than a lexical variable,with a fresh local value for each invocation, to avoid unexpected sharingviolations. Per recent -hackers discussion.
1 parentb32000e commit21e343d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

‎doc/src/sgml/plperl.sgml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.53 2006/05/26 17:34:16 adunstan Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.54 2006/05/29 13:51:23 adunstan Exp $ -->
22

33
<chapter id="plperl">
44
<title>PL/Perl - Perl Procedural Language</title>
@@ -660,8 +660,9 @@ $$ LANGUAGE plperl;
660660
<para>
661661
PL/Perl can be used to write trigger functions. In a trigger function,
662662
the hash reference <varname>$_TD</varname> contains information about the
663-
current trigger event. The fields of the <varname>$_TD</varname> hash
664-
reference are:
663+
current trigger event. <varname>$_TD</> is a global variable,
664+
which gets a separate local value for each invocation of the trigger.
665+
The fields of the <varname>$_TD</varname> hash reference are:
665666

666667
<variablelist>
667668
<varlistentry>

‎src/pl/plperl/plperl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plperl.c - perl as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.109 2006/05/26 17:34:16 adunstan Exp $
4+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.110 2006/05/29 13:51:23 adunstan Exp $
55
*
66
**********************************************************************/
77

@@ -771,7 +771,7 @@ plperl_create_sub(char *s, bool trusted)
771771
ENTER;
772772
SAVETMPS;
773773
PUSHMARK(SP);
774-
XPUSHs(sv_2mortal(newSVpv("my $_TD=$_[0]; shift;",0)));
774+
XPUSHs(sv_2mortal(newSVpv("our $_TD; local $_TD=$_[0]; shift;",0)));
775775
XPUSHs(sv_2mortal(newSVpv(s,0)));
776776
PUTBACK;
777777

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp