Re: BUG #6316: function search_path causes set_config() is_local = true to have no effect

From: Jon Erdman <postgresql(at)thewickedtribe(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org, postgresql(at)thewickedtribe(dot)net
Subject: Re: BUG #6316: function search_path causes set_config() is_local = true to have no effect
Date: 2011-12-02 06:48:08
Message-ID: 4ED874A8.2040904@thewickedtribe.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

DOH! *facepalm* Thanks Tom!

I read docs on set_config() and didn't think to check CREATE FUNCTION.
It does make sense, and now that you point it out, I do remember that
too. I didn't think to check it because this function is *not* secdef,
which is when you'd normally set a search_path on it (a dev
accidentally set it on a non-secdef function).

Thanks, and apologies for the false alarm.

/me slinks away sheepishly...
- --
Jon T Erdman (aka StuckMojo)
PostgreSQL Zealot

On 12/02/2011 12:27 AM, Tom Lane wrote:
> postgresql(at)thewickedtribe(dot)net writes:
>> So, found this in 8.3 but tested and it effects everything up to
>> 9.1.1. If search_path on a function is set to anything, calls to
>> set_config() with is_local = true inside that function have no
>> effect.
>
> Isn't that exactly what the CREATE FUNCTION reference page says?
>
> The SET clause causes the specified configuration parameter to be
> set to the specified value when the function is entered, and then
> restored to its prior value when the function exits. SET FROM
> CURRENT saves the session's current value of the parameter as the
> value to be applied when the function is entered.
>
> If a SET clause is attached to a function, then the effects of a
> SET LOCAL command executed inside the function for the same
> variable are restricted to the function: the configuration
> parameter's prior value is still restored at function exit.
> However, an ordinary SET command (without LOCAL) overrides the SET
> clause, much as it would do for a previous SET LOCAL command: the
> effects of such a command will persist after function exit, unless
> the current transaction is rolled back.
>
>
> regards, tom lane
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7YdKgACgkQRAk1+p0GhSFeHwCeJGNfW9VDeJ68EVZ/trLN6PpZ
SIsAnRlj/wr3YO+MF1lSeEEP1UzukhDI
=ZV2E
-----END PGP SIGNATURE-----

Attachment Content-Type Size
0x9D068521.asc application/pgp-keys 2.1 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message hmf 2011-12-02 09:48:01 BUG #6317: sequence error for pg_dump
Previous Message Tom Lane 2011-12-02 06:27:14 Re: BUG #6316: function search_path causes set_config() is_local = true to have no effect