Re: [GENERAL] plperl exception catching

2006-12-14 Thread Marc Evans
On Wed, 13 Dec 2006, Martijn van Oosterhout wrote: On Wed, Dec 13, 2006 at 05:04:42PM -0500, Tom Lane wrote: Bricklen Anderson <[EMAIL PROTECTED]> writes: Marc Evans wrote: OK, I must be missing something obvious: ERROR: creation of Perl function failed: 'eval "string"' trapped by operation

Re: [GENERAL] plperl exception catching

2006-12-13 Thread Martijn van Oosterhout
On Wed, Dec 13, 2006 at 05:04:42PM -0500, Tom Lane wrote: > Bricklen Anderson <[EMAIL PROTECTED]> writes: > > Marc Evans wrote: > >> OK, I must be missing something obvious: > >> ERROR: creation of Perl function failed: 'eval "string"' trapped by > >> operation mask at line 2. > > > Try as plper

Re: [GENERAL] plperl exception catching

2006-12-13 Thread Tom Lane
Bricklen Anderson <[EMAIL PROTECTED]> writes: > Marc Evans wrote: >> OK, I must be missing something obvious: >> ERROR: creation of Perl function failed: 'eval "string"' trapped by >> operation mask at line 2. > Try as plperlu This brings up the question of whether it'd be safe to allow eval in

Re: [GENERAL] plperl exception catching

2006-12-13 Thread Bricklen Anderson
Marc Evans wrote: OK, I must be missing something obvious: c3i=> CREATE OR REPLACE FUNCTION foo_trigger() RETURNS TRIGGER AS $$ c3i$> eval { spi_exec_query('INSERT INTO FOO_BAR VALUES(1)'); } || c3i$> spi_exec_query('SELECT 1 as foo'); c3i$> $$ LANGUAGE plperl; ERROR: creation of Perl funct

Re: [GENERAL] plperl exception catching

2006-12-13 Thread Marc Evans
On Wed, 13 Dec 2006, Tom Lane wrote: Marc Evans <[EMAIL PROTECTED]> writes: Is it accurate for me to believe that there is no way to catch exception within plperl? You do it the same way you trap any other error in perl ... OK, I must be missing something obvious: c3i=> CREATE OR REPLACE

Re: [GENERAL] plperl exception catching

2006-12-13 Thread Tom Lane
Marc Evans <[EMAIL PROTECTED]> writes: > Is it accurate for me to believe that there is no way to catch exception > within plperl? You do it the same way you trap any other error in perl ... regards, tom lane ---(end of broadcast)-

[GENERAL] plperl exception catching

2006-12-13 Thread Marc Evans
Hi - Is it accurate for me to believe that there is no way to catch exception within plperl? For example, if an update fails, I'd like to do an insert. Yes, this is trivial to do in plpgsql, but sadly plpgsql is not usable due to not supporting variable variables. If plperl can't catch excepti