Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id E7F209F9AD4 for ; Wed, 3 Oct 2007 16:15:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 21446-01 for ; Wed, 3 Oct 2007 16:15:23 -0300 (ADT) X-Greylist: delayed 00:12:20.322924 by SQLgrey-1.7.5 Received: from mail.scharp.org (MAIL.SCHARP.ORG [140.107.164.89]) by postgresql.org (Postfix) with ESMTP id 7EFE59F968E for ; Wed, 3 Oct 2007 16:15:25 -0300 (ADT) Received: from [10.6.124.130] (HIVEXT-A.SCHARP.ORG [140.107.164.66]) by mail.scharp.org (8.13.6+Sun/8.13.6) with ESMTP id l93J33eg025960 for ; Wed, 3 Oct 2007 12:03:03 -0700 (PDT) Message-ID: <4703E767.8020901@scharp.org> Date: Wed, 03 Oct 2007 12:03:03 -0700 From: Robert Kleemann User-Agent: Thunderbird 2.0.0.4 (X11/20070604) MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: request for more descriptive plperl error messages Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200710/1 X-Sequence-Number: 6628 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