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

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
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:27:29
Message-ID: 87a7kgsorn.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "Zexuan" == Zexuan Luo <spacewanderlzx(at)gmail(dot)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)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kristjan Tammekivi 2019-01-04 10:45:42 Potentially undocumented behaviour change in Postgres 11 concerning OLD record in an after insert trigger
Previous Message Rene Romero Benavides 2019-01-04 10:18:18 Re: Function `set_config` doesn't work in with query?