Re: errcontext support in PL/Perl

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: errcontext support in PL/Perl
Date: 2009-07-21 16:15:29
Message-ID: 36F922D1-FD48-4883-9624-66CC08D03025@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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 itself and updates regression tests. I'll appreciate any
>> suggestions on how to improve it.
>
> 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. I don't see any
problems with SPI calls:

test=# create function perl_log1() returns void language plperl as $$
test$# elog(NOTICE, "Test from function one");
test$# $$
test-# ;
CREATE FUNCTION

test=# create function perl_log2() returns void language plperl as $
$
elog
(NOTICE, "Test from function two");
my $rv = spi_exec_query('SELECT * FROM perl_log1()');
$$;
CREATE FUNCTION

test=# select perl_log2();
NOTICE: Test from function two
CONTEXT: PL/Perl function "perl_log2"
NOTICE: Test from function one
CONTEXT: PL/Perl function "perl_log1"
SQL statement "SELECT * FROM perl_log1()"
PL/Perl function "perl_log1"
perl_log2
-----------

(1 row)

--
Alexey Klyukin http://www.CommandPrompt.com
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-07-21 16:17:14 Re: git revisited
Previous Message Tom Lane 2009-07-21 16:07:06 Re: [PATCH v4] Avoid manual shift-and-test logic in AllocSetFreeIndex