Re: BUG #5571: global hash %_SHARED is not declared as global in the new version - Mailing list pgsql-bugs

From Alex Hunsaker
Subject Re: BUG #5571: global hash %_SHARED is not declared as global in the new version
Date
Msg-id AANLkTinhL=sSbRe4xsczTt_OsFWvWqB2y7wjgRa5v7rB@mail.gmail.com
Whole thread Raw
In response to BUG #5571: global hash %_SHARED is not declared as global in the new version  ("mile" <mile@avangardsolutions.com>)
Responses Re: BUG #5571: global hash %_SHARED is not declared as global in the new version  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-bugs
On Mon, Jul 26, 2010 at 03:58, mile <mile@avangardsolutions.com> wrote:
> To reproduce this use the following function:
>
> create or replace function perl_shared() returns void as $$
> use strict;
> elog(INFO, $_SHARED{'stuff'});
> $_SHARED{'stuff'} = '1';
> for my $k (keys %_SHARED)
> {
>    elog(INFO, $k);
> }
> $$ language plperl;

Great, Thanks!  The below patch fixes it for me.  Basically we
declared %_SHARED inside the PostgreSQL::InServer; package when it
needed to be declared in main::.  For the curious 8.4 and down don't
have this issue as the "use vars qw(%_SHARED)" is in the PERL_BOOT
define, which gets run at the interp start-up time (basically its perl
-e PERL_BOOT).


*** a/src/pl/plperl/plc_perlboot.pl
--- b/src/pl/plperl/plc_perlboot.pl
***************
*** 2,7 ****
--- 2,8 ----
  #  $PostgreSQL: pgsql/src/pl/plperl/plc_perlboot.pl,v 1.5 2010/02/16
21:39:52 adunstan Exp $

  use 5.008001;
+ use vars qw(%_SHARED);

  PostgreSQL::InServer::Util::bootstrap();

***************
*** 9,15 **** package PostgreSQL::InServer;

  use strict;
  use warnings;
- use vars qw(%_SHARED);

  sub plperl_warn {
      (my $msg = shift) =~ s/\(eval \d+\) //g;
--- 10,15 ----

Attachment

pgsql-bugs by date:

Previous
From: Jeff Davis
Date:
Subject: Re: page corruption after moving tablespace
Next
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5572: Error Trying to connec from Crystal Reports to Sever PostgreSQL