Thank you!

Something like
```
with t as (
    select set_config('ns.blah', '1', false) as res
)
    select res from t;
select current_setting('ns.blah');
```
works for me.

Andrew Gierth <and...@tao11.riddles.org.uk> 于2019年1月4日周五 下午6:27写道:
>
> >>>>> "Zexuan" == Zexuan Luo <spacewander...@gmail.com> writes:
>
>  Zexuan> For instance:
>  Zexuan> ```
>  Zexuan> with t as (
>  Zexuan>     select set_config('blah', '1', false)
>  Zexuan> )
>  Zexuan>     select current_setting('blah');
>
> A CTE containing a SELECT query which is not referenced anywhere will
> not be executed, even if it contains volatile functions. (CTEs
> containing INSERT/UPDATE/DELETE that are not referenced _will_ still be
> executed.)
>
> --
> Andrew (irc:RhodiumToad)

Reply via email to