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

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2542: ALTER USER foo SET bar = func(baz) errors out
Date: 2006-07-21 03:08:00
Message-ID: 20060721030800.GC4097@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Jul 20, 2006 at 10:46:27PM -0400, Tom Lane wrote:
> "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!

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alaa El Gohary 2006-07-21 07:41:02 BUG #2543: Performance delay acrros the same day
Previous Message Tom Lane 2006-07-21 02:46:27 Re: BUG #2542: ALTER USER foo SET bar = func(baz) errors out