Unix Technical Forum

Disparity in search_path SHOW and SET

This is a discussion on Disparity in search_path SHOW and SET within the pgsql Hackers forums, part of the PostgreSQL category; --> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm trying to figure out a way to modify the search_path temporarily, but ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 07:24 AM
Greg Sabino Mullane
 
Posts: n/a
Default Disparity in search_path SHOW and SET


-----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@turnstep.com
PGP Key: 0x14964AC8 200512201205
http://biglumber.com/x/web?pk=2529DF...9B906714964AC8
-----BEGIN PGP SIGNATURE-----

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



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 07:24 AM
Tom Lane
 
Posts: n/a
Default Re: Disparity in search_path SHOW and SET

"Greg Sabino Mullane" <greg@turnstep.com> writes:
> This works fine:


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


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


Well, sure, because you told it to. Why isn't the last parameter
"false"?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 07:24 AM
Greg Sabino Mullane
 
Posts: n/a
Default Re: Disparity in search_path SHOW and SET


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


> Well, sure, because you told it to. Why isn't the last parameter "false"?


Thanks. I knew I was overlooking something. I've obviously been staring at
the code too long. Still, would it make more sense for SHOW search_path
to return this:

"$user",public

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200512201227
http://biglumber.com/x/web?pk=2529DF...9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFDqD83vJuQZxSWSsgRAj1gAKDIRGqzD7zORJQwrxLM+o KWOiAPKgCg9/xK
OGZIoWEnLdw+Qi71lKbCg0g=
=0dBJ
-----END PGP SIGNATURE-----



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 07:24 AM
Tom Lane
 
Posts: n/a
Default Re: Disparity in search_path SHOW and SET

"Greg Sabino Mullane" <greg@turnstep.com> writes:
> Still, would it make more sense for SHOW search_path
> to return this:
> "$user",public


Can't get excited about it. SHOW is meant for human consumption,
not programs ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com