pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Zexuan Luo <spacewanderlzx@gmail.com>
Cc: pgsql-general\@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Function `set_config` doesn't work in with query?
Date: Fri, 04 Jan 2019 10:27:29 +0000
Message-ID: <87a7kgsorn.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <CAADJU12T-Zxuah=3+821YjyL5M9_r-Cmvyjp2VWSjGVrWisjEQ@mail.gmail.com>
References: <CAADJU12T-Zxuah=3+821YjyL5M9_r-Cmvyjp2VWSjGVrWisjEQ@mail.gmail.com>

>>>>> "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)




view thread (4+ messages)  latest in thread

Message-ID: <87a7kgsorn.fsf@news-spur.riddles.org.uk>
Permalink:  ../87a7kgsorn.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87a7kgsorn.fsf@news-spur.riddles.org.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, spacewanderlzx@gmail.com
  Subject: Re: Function `set_config` doesn't work in with query?
  In-Reply-To: <87a7kgsorn.fsf@news-spur.riddles.org.uk>
  References: <CAADJU12T-Zxuah=3+821YjyL5M9_r-Cmvyjp2VWSjGVrWisjEQ@mail.gmail.com> <87a7kgsorn.fsf@news-spur.riddles.org.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox