dbTalk Databases Forums  

[BUGS] BUG #2542: ALTER USER foo SET bar = func(baz) errors out

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2542: ALTER USER foo SET bar = func(baz) errors out in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default [BUGS] BUG #2542: ALTER USER foo SET bar = func(baz) errors out - 07-20-2006 , 08:43 PM







The following bug has been logged online:

Bug reference: 2542
Logged by: David Fetter
Email address: david (AT) fetter (DOT) org
PostgreSQL version: All
Operating system: All
Description: ALTER USER foo SET bar = func(baz) errors out
Details:

foo=> ALTER USER foo SET search_path = current_setting('search_path');
ERROR: syntax error at or near "(" at character 52
LINE 1: ...LTER USER foo SET search_path = current_setting('search_p...

is there some way to let the right hand side of SET be the (TEXT) output of
a function?

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

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] BUG #2542: ALTER USER foo SET bar = func(baz) errors out - 07-20-2006 , 10:08 PM






"David Fetter" <david (AT) fetter (DOT) org> writes:
Quote:
is there some way to let the right hand side of SET be the (TEXT) output of
a function?
No. SET is a utility command and utility commands generally don't do
expression evaluation. (There are some specific reasons why not for
SET, but I won't get into that here.)

However, you can get the desired effect in various other ways; see the
set_config() function, or try updating the pg_settings view ...

regards, tom lane

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


Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] BUG #2542: ALTER USER foo SET bar = func(baz) errors out - 07-20-2006 , 10:10 PM



On Thu, Jul 20, 2006 at 10:46:27PM -0400, Tom Lane wrote:
Quote:
"David Fetter" <david (AT) fetter (DOT) org> writes:
is there some way to let the right hand side of SET be the (TEXT)
output of a function?

No. SET is a utility command and utility commands generally don't
do expression evaluation. (There are some specific reasons why not
for SET, but I won't get into that here.)

However, you can get the desired effect in various other ways; see
the set_config() function, or try updating the pg_settings view ...
foo=> UPDATE pg_catalog.pg_settings SET setting = 'bar,' || setting
WHERE "name"='search_path';
-[ RECORD 1 ]----------------
set_config | bar,$user,public

That's a neat trick

However:

psql foo foo
foo=> SHOW search_path ;
search_path
--------------
$user,public
(1 row)

How do I make it permanent?

Cheers,
D
--
David Fetter <david (AT) fetter (DOT) org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!

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


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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.