pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
request for more descriptive plperl error messages
6+ messages / 3 participants
[nested] [flat]

* request for more descriptive plperl error messages
@ 2007-10-03 19:03 Robert Kleemann <kleemann@scharp.org>
  2007-10-05 14:18 ` Re: request for more descriptive plperl error messages Peter Eisentraut <peter_e@gmx.net>
  2007-10-05 19:15 ` Re: request for more descriptive plperl error messages Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 6+ messages in thread

From: Robert Kleemann @ 2007-10-03 19:03 UTC (permalink / raw)
  To: pgsql-interfaces

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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: request for more descriptive plperl error messages
  2007-10-03 19:03 request for more descriptive plperl error messages Robert Kleemann <kleemann@scharp.org>
@ 2007-10-05 14:18 ` Peter Eisentraut <peter_e@gmx.net>
  2007-10-05 15:28   ` Re: request for more descriptive plperl error messages Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 6+ messages in thread

From: Peter Eisentraut @ 2007-10-05 14:18 UTC (permalink / raw)
  To: pgsql-interfaces; +Cc: Robert Kleemann <kleemann@scharp.org>

Am Mittwoch, 3. Oktober 2007 schrieb Robert Kleemann:
> 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).

You need to increase the error verbosity in psql, by running

\set VERBOSITY verbose

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: request for more descriptive plperl error messages
  2007-10-03 19:03 request for more descriptive plperl error messages Robert Kleemann <kleemann@scharp.org>
  2007-10-05 14:18 ` Re: request for more descriptive plperl error messages Peter Eisentraut <peter_e@gmx.net>
@ 2007-10-05 15:28   ` Tom Lane <tgl@sss.pgh.pa.us>
  2007-10-05 17:19     ` Re: request for more descriptive plperl error messages Robert Kleemann <kleemann@scharp.org>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2007-10-05 15:28 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-interfaces@postgresql.org, Robert Kleemann <kleemann@scharp.org>

Peter Eisentraut <peter_e@gmx.net> writes:
> Am Mittwoch, 3. Oktober 2007 schrieb Robert Kleemann:
>> 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).

> You need to increase the error verbosity in psql, by running
> \set VERBOSITY verbose

Doesn't seem like that's going to provide the info he wants, namely the
name of the plperl function that's being executed.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: request for more descriptive plperl error messages
  2007-10-03 19:03 request for more descriptive plperl error messages Robert Kleemann <kleemann@scharp.org>
  2007-10-05 14:18 ` Re: request for more descriptive plperl error messages Peter Eisentraut <peter_e@gmx.net>
  2007-10-05 15:28   ` Re: request for more descriptive plperl error messages Tom Lane <tgl@sss.pgh.pa.us>
@ 2007-10-05 17:19     ` Robert Kleemann <kleemann@scharp.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Kleemann @ 2007-10-05 17:19 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-interfaces

Tom's right. \set VERBOSITY versbose gives me:

ERROR:  XX000: error from Perl function: syntax error at or near "." at 
line 58.
LOCATION:  plperl_call_perl_func, plperl.c:1076

but doesn't give the name of the plperl function.

Robert.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: request for more descriptive plperl error messages
  2007-10-03 19:03 request for more descriptive plperl error messages Robert Kleemann <kleemann@scharp.org>
@ 2007-10-05 19:15 ` Tom Lane <tgl@sss.pgh.pa.us>
  2007-10-05 21:05   ` Re: request for more descriptive plperl error messages Robert Kleemann <kleemann@scharp.org>
  1 sibling, 1 reply; 6+ messages in thread

From: Tom Lane @ 2007-10-05 19:15 UTC (permalink / raw)
  To: Robert Kleemann <kleemann@scharp.org>; +Cc: pgsql-interfaces

Robert Kleemann <kleemann@scharp.org> writes:
> 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?

No.  The easiest thing to do is save it in the plperl_proc_desc struct.
See
http://archives.postgresql.org/pgsql-committers/2007-10/msg00117.php

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: request for more descriptive plperl error messages
  2007-10-03 19:03 request for more descriptive plperl error messages Robert Kleemann <kleemann@scharp.org>
  2007-10-05 19:15 ` Re: request for more descriptive plperl error messages Tom Lane <tgl@sss.pgh.pa.us>
@ 2007-10-05 21:05   ` Robert Kleemann <kleemann@scharp.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Kleemann @ 2007-10-05 21:05 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces

Thanks for the fix Tom. You're awesome!

I assume the fix won't be in the official pg until 8.3 right? I'll need 
to patch my local installation.

Robert.




^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2007-10-05 21:05 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-10-03 19:03 request for more descriptive plperl error messages Robert Kleemann <kleemann@scharp.org>
2007-10-05 14:18 ` Peter Eisentraut <peter_e@gmx.net>
2007-10-05 15:28   ` Tom Lane <tgl@sss.pgh.pa.us>
2007-10-05 17:19     ` Robert Kleemann <kleemann@scharp.org>
2007-10-05 19:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-10-05 21:05   ` Robert Kleemann <kleemann@scharp.org>

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