Re: [HACKERS] errcontext support in PL/Perl

2009-09-16 Thread Alvaro Herrera
Selena Deckelmann escribió: > From the patch review group this evening, courtesy of Webb Sprague and > Brent Dombrowski. I'm replying on their behalf so that this response > is in the correct thread. > > Looks like Peter also reviewed, but I'm forwarding this on anyway. > > (Note: Problem runnin

Re: [HACKERS] errcontext support in PL/Perl

2009-09-15 Thread Peter Eisentraut
On Tue, 2009-07-21 at 20:54 +0300, Alexey Klyukin wrote: > Attached is the updated version of the patch (the original description > is here: http://archives.postgresql.org/pgsql-hackers/2009-07/msg01332.php) > that doesn't use global variables. It also shows the last line of > the context in

Re: [HACKERS] errcontext support in PL/Perl

2009-09-15 Thread Selena Deckelmann
>From the patch review group this evening, courtesy of Webb Sprague and Brent Dombrowski. I'm replying on their behalf so that this response is in the correct thread. Looks like Peter also reviewed, but I'm forwarding this on anyway. (Note: Problem running regressions because make check doesn't

Re: [HACKERS] errcontext support in PL/Perl

2009-09-15 Thread Tom Lane
Peter Eisentraut writes: > On tis, 2009-09-15 at 11:32 -0400, Tom Lane wrote: >> FWIW, I don't particularly agree with that --- there is no reason to >> suppose that all PLs will want to do this exactly the same way. > I'd imagine that we simply set the context to "$language function > $name", pr

Re: [HACKERS] errcontext support in PL/Perl

2009-09-15 Thread Peter Eisentraut
On tis, 2009-09-15 at 11:32 -0400, Tom Lane wrote: > Peter Eisentraut writes: > > But for extra credit, couldn't we code it so that the context is set > > before the PL handler is called, so that we get this functionality into > > all PLs at once? > > FWIW, I don't particularly agree with that --

Re: [HACKERS] errcontext support in PL/Perl

2009-09-15 Thread Tom Lane
Peter Eisentraut writes: > But for extra credit, couldn't we code it so that the context is set > before the PL handler is called, so that we get this functionality into > all PLs at once? FWIW, I don't particularly agree with that --- there is no reason to suppose that all PLs will want to do th

Re: [HACKERS] errcontext support in PL/Perl

2009-09-15 Thread Peter Eisentraut
On Tue, 2009-07-21 at 20:54 +0300, Alexey Klyukin wrote: > Attached is the updated version of the patch (the original description > is here: http://archives.postgresql.org/pgsql-hackers/2009-07/msg01332.php) > that doesn't use global variables. Patch looks OK. But for extra credit, couldn't

Re: [HACKERS] errcontext support in PL/Perl

2009-07-21 Thread Alexey Klyukin
On Jul 21, 2009, at 7:47 PM, Alexey Klyukin wrote: On Jul 21, 2009, at 7:20 PM, Alvaro Herrera wrote: Alexey Klyukin wrote: NOTICE: Test from function one CONTEXT: PL/Perl function "perl_log1" SQL statement "SELECT * FROM perl_log1()" PL/Perl function "perl_log1" Shouldn't the second "

Re: [HACKERS] errcontext support in PL/Perl

2009-07-21 Thread Alexey Klyukin
On Jul 21, 2009, at 7:20 PM, Alvaro Herrera wrote: Alexey Klyukin wrote: NOTICE: Test from function one CONTEXT: PL/Perl function "perl_log1" SQL statement "SELECT * FROM perl_log1()" PL/Perl function "perl_log1" Shouldn't the second "PL/Perl function" line say perl_log2 instead? Hm, ye

Re: [HACKERS] errcontext support in PL/Perl

2009-07-21 Thread Tom Lane
Alexey Klyukin writes: > On Jul 21, 2009, at 6:39 PM, Alvaro Herrera wrote: >> Hmm, in plperl_exec_callback(), does the global variable work if you >> call one plperl function from another? > PL/Perl functions can't call each other directly. Still, it's poor style to rely on the global variable

Re: [HACKERS] errcontext support in PL/Perl

2009-07-21 Thread Alvaro Herrera
Alexey Klyukin wrote: > NOTICE: Test from function one > CONTEXT: PL/Perl function "perl_log1" > SQL statement "SELECT * FROM perl_log1()" > PL/Perl function "perl_log1" Shouldn't the second "PL/Perl function" line say perl_log2 instead? -- Alvaro Herrerahttp:/

Re: [HACKERS] errcontext support in PL/Perl

2009-07-21 Thread Alexey Klyukin
On Jul 21, 2009, at 6:39 PM, Alvaro Herrera wrote: Alexey Klyukin wrote: Attached is a patch (HEAD) that sets errcontext with PL/Perl function name, making a distinction between compilation and execution stages, fixes error messages where function name was already included in the message itse

Re: [HACKERS] errcontext support in PL/Perl

2009-07-21 Thread Alvaro Herrera
Alexey Klyukin wrote: > Attached is a patch (HEAD) that sets errcontext with PL/Perl function > name, making a distinction between compilation and execution stages, > fixes error messages where function name was already included in the > message itself and updates regression tests. I'll appr

[HACKERS] errcontext support in PL/Perl

2009-07-21 Thread Alexey Klyukin
Hi, While trying to build a custom error reporting function for one of our clients we came across the fact that PL/Perl doesn't set errcontext that we relied on to get the traceback of running functions. Exactly the same problem with PL/Python was fixed recently by Peter Eisentraut (http: