Re: Function `set_config` doesn't work in with query?

From: Rene Romero Benavides <rene(dot)romero(dot)b(at)gmail(dot)com>
To: Zexuan Luo <spacewanderlzx(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Function `set_config` doesn't work in with query?
Date: 2019-01-04 10:18:18
Message-ID: CANaGW0_iM01Q=p5c=k0aM-Kn5jdL92xgxEOfjZ5RSNo1YXOafw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jan 4, 2019 at 3:37 AM Zexuan Luo <spacewanderlzx(at)gmail(dot)com> wrote:

> For instance:
> ```
> with t as (
> select set_config('blah', '1', false)
> )
> select current_setting('blah');
> select current_setting('blah');
> ```
>
> Execute queries above gets these error messages:
> psql:test-query-dump.sql:4: ERROR: unrecognized configuration parameter
> "blah"
> psql:test-query-dump.sql:5: ERROR: unrecognized configuration parameter
> "blah"
>
> Thank you for any responses.
>
>
The only parameters you can set that way, are the ones listed in:
SELECT name FROM pg_settings;

For user defined parameters, check this:
https://dba.stackexchange.com/questions/29961/how-do-i-set-and-get-custom-database-variables

--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gierth 2019-01-04 10:27:29 Re: Function `set_config` doesn't work in with query?
Previous Message Zexuan Luo 2019-01-04 09:36:55 Function `set_config` doesn't work in with query?