Disparity in search_path SHOW and SET

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Disparity in search_path SHOW and SET
Date: 2005-12-20 17:15:46
Message-ID: a8ffcb190e9012fc4395e23e7c27685a@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


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

I'm trying to figure out a way to modify the search_path temporarily, but
the "$user" construct is making this difficult. I need to prepend a schema
to the path. This works fine:

SELECT set_config('search_path', '$schema,' || current_setting('search_path'), true);

...but does not last outside of a transaction.

The problem is really that the output of "SHOW search_path" cannot be fed
back into "SET search_path" if the search_path contains the string "$user".

My only option appears to be to have the application parse the string returned
from SHOW search_path, quote the dollar-values, and rebuild the string. Is
there an easier way?

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200512201205
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFDqDvOvJuQZxSWSsgRAgUKAKDrRJoCfe8M7Fe2mi+/KFlEKKn+fQCgthpw
jPV95zpbejZsaRvIBeLd8rM=
=xRza
-----END PGP SIGNATURE-----

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-20 17:21:20 Re: Disparity in search_path SHOW and SET
Previous Message Dave Page 2005-12-20 08:17:53 Re: [pgadmin-hackers] Client-side password encryption

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-12-20 17:21:20 Re: Disparity in search_path SHOW and SET
Previous Message Tom Lane 2005-12-20 17:08:05 Re: PLpgSQL: list of scalars as row for assign stmt, fore and fors stms