FAQ
--
-- An SQL error causes subsequent function creation of an otherwise
-- healthy function to fail WHEN RUN with:
-- ERROR: creation of function failed:
-- (in cleanup) Undefined subroutine &PLPerl::mksafefunc called at (eval 4) line 4.
--
-- Workaround is to close and reopen the connection after an SQL failure
--
create or replace function plperl_bug1( )
returns text as
'
my $qry = ''select * from pg_user'';
elog NOTICE, ''Good Query is: $qry'';
my $rv = spi_exec_query( $qry );
elog NOTICE, $rv->{status};
elog NOTICE, @{$rv->{rows}};
return $qry;
' language 'plperl';

select plperl_bug1();

create or replace function plperl_bug2( )
returns text as
'
my $qry = ''select * from pg_userssssssssssssssss'';
elog NOTICE, ''Bad Query is: $qry'';
my $rv = spi_exec_query( $qry );
elog NOTICE, $rv->{status};
elog NOTICE, @{$rv->{rows}};
return $qry;
' language 'plperl';
select plperl_bug2();

--
-- same as above definition
--
create or replace function plperl_bug1( )
returns text as
'
my $qry = ''select * from pg_user'';
elog NOTICE, ''Good Query is: $qry'';
my $rv = spi_exec_query( $qry );
elog NOTICE, $rv->{status};
elog NOTICE, @{$rv->{rows}};
return $qry;
' language 'plperl';

select plperl_bug1();

Search Discussions

  • Andrew Dunstan at Jul 5, 2004 at 1:52 pm
    I am unable to reproduce this effect.

    The script below (slightly adapted from yours) runs just fine repeatedly
    in the same session with expected results.

    create or replace function plperl_bug1( )
    returns text as
    $$
    my $qry = 'select * from pg_user';
    elog NOTICE, "Good Query is: $qry";
    my $rv = spi_exec_query( $qry );
    elog NOTICE, "status: $rv->{status} processed: $rv->{processed}";
    return $qry;
    $$ language plperl;

    select plperl_bug1();

    create or replace function plperl_bug2( )
    returns text as
    $$
    my $qry = "select * from pg_userssssssssssssssss";
    elog NOTICE, "Bad Query is: $qry";
    my $rv = spi_exec_query( $qry );
    elog NOTICE, "status: $rv->{status} processed: $rv->{processed}";
    return $qry;
    $$ language plperl;

    select plperl_bug2();


    cheers

    andrew

    elein wrote:
    --
    -- An SQL error causes subsequent function creation of an otherwise
    -- healthy function to fail WHEN RUN with:
    -- ERROR: creation of function failed:
    -- (in cleanup) Undefined subroutine &PLPerl::mksafefunc called at (eval 4) line 4.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedJul 5, '04 at 1:10a
activeJul 5, '04 at 1:52p
posts2
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Elein: 1 post Andrew Dunstan: 1 post

People

Translate

site design / logo © 2022 Grokbase