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 ----