Re: Append to a GUC parameter ?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Append to a GUC parameter ?
Date: 2014-08-06 15:22:15
Message-ID: 20140806152215.GK13302@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 6, 2014 at 12:12:29AM -0300, Fabrízio de Royes Mello wrote:
>
> On Tue, Aug 5, 2014 at 10:55 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Josh Berkus <josh(at)agliodbs(dot)com> writes:
> > BTW, while there's unlikely to be a good reason to put search_path in
> > pg.conf with appends, there are a LOT of reasons to want to be able to
> > append to it during a session.
>
> [shrug...]  You can do that today with current_setting()/set_config().
>
>
>
> +1
>
> With a very simple statement you can do that:
>
> fabrizio=# SELECT current_setting('search_path');
>  current_setting
> -----------------
>  "$user",public
> (1 row)
>
> fabrizio=# SELECT set_config('search_path', current_setting('search_path')||',
> another_schema', false);
>            set_config          
> --------------------------------
>  "$user",public, another_schema
> (1 row)

Yes, that is very nice, but it only works for session-level changes,
i.e. you can't use that in postgresql.conf or via ALTER USER/DATABASE.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-08-06 15:35:15 Re: Fixed redundant i18n strings in json
Previous Message Bruce Momjian 2014-08-06 15:20:50 Re: Proposal: Incremental Backup