Re: GUC failure on exception - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: GUC failure on exception
Date
Msg-id 4B569402.6080400@dunslane.net
Whole thread Raw
In response to GUC failure on exception  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: GUC failure on exception  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers

Andrew Dunstan wrote:
>
> Tim Bunce just showed me the following oddity:
>
>    andrew=# SET SESSION plperl.use_strict = on;
>    SET
>    andrew=# SHOW plperl.use_strict;
>     plperl.use_strict
>    -------------------
>     on
>    (1 row)
>
>    andrew=# DO $$ elog(ERROR,"error") $$ language plperl;
>    ERROR:  error at line 1.
>    CONTEXT:  PL/Perl anonymous code block
>    andrew=# SHOW plperl.use_strict;
>     plperl.use_strict
>    -------------------
>     off
>    (1 row)
>
>
> Somehow we have lost the setting, because the first use of plperl, 
> which called the plperl init code, failed.
>
> It appears that whatever rolls it back forgets to put the GUC setting 
> back as it was, and now it's lost, which is pretty darn ugly. And you 
> can now run code which fails the 'strict' tests.
>
>

The first thing I think we need to do is move the GUC processing code 
out of _PG_init() and into plperl_init_interp(), protected by a flag to 
make sure it's only called successfully once. I'm trying to work out a 
neat way to put the value back if there is an exception, but it's a bit 
ugly.

cheers

andrew


pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: [PERFORM] Re: Faster CREATE DATABASE by delaying fsync (was 8.4.1 ubuntu karmic slow createdb)
Next
From: Tom Lane
Date:
Subject: Re: An example of bugs for Hot Standby