Re: BUG #5571: global hash %_SHARED is not declared as global in the new version

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: mile <mile(at)avangardsolutions(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5571: global hash %_SHARED is not declared as global in the new version
Date: 2010-07-26 16:55:34
Message-ID: AANLkTinhL=sSbRe4xsczTt_OsFWvWqB2y7wjgRa5v7rB@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jul 26, 2010 at 03:58, mile <mile(at)avangardsolutions(dot)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 Content-Type Size
plperl_main_shared.patch text/x-patch 502 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2010-07-26 17:08:15 Re: BUG #5572: Error Trying to connec from Crystal Reports to Sever PostgreSQL
Previous Message Jeff Davis 2010-07-26 16:49:08 Re: page corruption after moving tablespace