pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Kleemann <kleemann@scharp.org>
To: pgsql-interfaces@postgresql.org
Subject: request for more descriptive plperl error messages
Date: Wed, 03 Oct 2007 12:03:03 -0700
Message-ID: <4703E767.8020901@scharp.org> (raw)

I've been maintaining a database that contains a very large number of 
plperl functions. An error in one of these functions will produce a 
message such as:

ERROR:  error from Perl function: syntax error at or near "." at line 58.

This is helpful to a degree but the critical missing information is the 
function name (schema name would be nice too). With the current behavior 
have to guess at what function might be causing this problem and then 
look up the line number and see if that makes sense. I then repeat this 
for the other functions until I get lucky.

Looking at src/pl/plperl/plperl.c I've found the following code:
        /* XXX need to find a way to assign an errcode here */
        ereport(ERROR,
                (errmsg("error from Perl function: %s",
                        strip_trailing_ws(SvPV(ERRSV, PL_na)))));

This is duplicated in plperl_call_perl_func() and 
plperl_call_perl_trigger_func()

I'd like to modify the code to return the perl function name and submit 
a patch but I've never developed in the postgres code base before and am 
not sure where to start. Can the function and schema name be found in 
the FunctionCallInfo structure that is passed? Is this an easy thing to 
do or a hard thing to do? Would anyone else find it useful? Does anyone 
else want to do it?

thanks!
Robert



view thread (6+ messages)  latest in thread

Message-ID: <4703E767.8020901@scharp.org>
Permalink:  ../4703E767.8020901@scharp.org/
Also on:    postgresql.org/message-id/4703E767.8020901@scharp.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: kleemann@scharp.org
  Subject: Re: request for more descriptive plperl error messages
  In-Reply-To: <4703E767.8020901@scharp.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox