Re: [GENERAL] Small patch for PL/Perl Misbehavior with

From: John Worsley <lx(at)openvein(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] Small patch for PL/Perl Misbehavior with
Date: 2002-10-05 03:41:45
Message-ID: Pine.LNX.4.21.0210041940300.9959-100000@baby.audiophonic.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 3 Oct 2002, Tom Lane wrote:
>That seems a little weird. Does Perl really expect people to do that
>(ie, is it a documented part of some API)? I wonder whether there is
>some other action that we're supposed to take instead, but are
>missing...

Not that I know of: clearing out the $@ variable manually was just my way
of getting around the problem in practice. I think the underlying issue
may be tied to the fact that it's running a function generated within a
Safe Module, but I'm not enough of a Perl Guru to say anything more
decisive than that.

>If this is what we'd have to do, I think a better way would be
>
> perlerrmsg = pstrdup(SvPV(ERRSV, PL_na));
> sv_setpv(perl_get_sv("@",FALSE),"");
> elog(ERROR, "plperl: error from function: %s", perlerrmsg);
>Splitting the ERROR into a NOTICE with the useful info and an ERROR
>without any isn't real good, because the NOTICE could get dropped on the
>floor (either because of min_message_level or a client that just plain
>loses notices).

Yeah, that's a cleaner solution. I take it anything pstrdup'd by
PostgreSQL gets freed automatically by the backend? (I wasn't familiar
enough with the backend to know how to ask for memory confident in the
understanding that it would at some point be freed. ;)

Jw.
--
John Worsley - lx(at)openvein(dot)com
http://www.openvein.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-10-05 03:51:12 Re: [GENERAL] Small patch for PL/Perl Misbehavior with Runtime Error Reporting
Previous Message Curtis Faith 2002-10-05 03:16:52 Re: Potential Large Performance Gain in WAL synching