Re: Function `set_config` doesn't work in with query? - Mailing list pgsql-general

From Andrew Gierth
Subject Re: Function `set_config` doesn't work in with query?
Date
Msg-id 87a7kgsorn.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Function `set_config` doesn't work in with query?  (Zexuan Luo <spacewanderlzx@gmail.com>)
Responses Re: Function `set_config` doesn't work in with query?
List pgsql-general
>>>>> "Zexuan" == Zexuan Luo <spacewanderlzx@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)


pgsql-general by date:

Previous
From: Rene Romero Benavides
Date:
Subject: Re: Function `set_config` doesn't work in with query?
Next
From: Kristjan Tammekivi
Date:
Subject: Potentially undocumented behaviour change in Postgres 11 concerningOLD record in an after insert trigger