pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Luzanov <p.luzanov@postgrespro.ru>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: psql variables in the DO command
Date: Mon, 5 Mar 2018 16:52:32 +0300
Message-ID: <f80e9cbb-75e8-d349-e5e9-6d33abca259b@postgrespro.ru> (raw)
In-Reply-To: <CAFj8pRCf0=rnpccADpt6tZepjxQneJ_Tz900Owjbd6jZAxChDQ@mail.gmail.com>
References: <5bae153c-ade4-ad24-bd46-857993240cfd@postgrespro.ru>
	<CAFj8pRCf0=rnpccADpt6tZepjxQneJ_Tz900Owjbd6jZAxChDQ@mail.gmail.com>

On 05.03.2018 16:42, Pavel Stehule wrote:
>
>     I can't use psql variable in the DO command. Is it intentional
>     behavior?
>
>
> yes. psql variables living on client side, and are not accessible from 
> server side . DO command is executed on server side.

But SELECT command also executed on a server side ))
I thought that the command is sent to the server after variable's 
replacement.

>
> you can copy psql variables to GUC variables by set_config function, 
> and then on server side use current_setting function for getting the 
> content.
Yes, I know about workarounds.


-----
Pavel Luzanov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

view thread (11+ messages)  latest in thread

Message-ID: <f80e9cbb-75e8-d349-e5e9-6d33abca259b@postgrespro.ru>
Permalink:  ../f80e9cbb-75e8-d349-e5e9-6d33abca259b@postgrespro.ru/
Also on:    postgresql.org/message-id/f80e9cbb-75e8-d349-e5e9-6d33abca259b@postgrespro.ru

 · 

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: p.luzanov@postgrespro.ru, pavel.stehule@gmail.com
  Subject: Re: psql variables in the DO command
  In-Reply-To: <f80e9cbb-75e8-d349-e5e9-6d33abca259b@postgrespro.ru>
  References: <5bae153c-ade4-ad24-bd46-857993240cfd@postgrespro.ru> <CAFj8pRCf0=rnpccADpt6tZepjxQneJ_Tz900Owjbd6jZAxChDQ@mail.gmail.com> <f80e9cbb-75e8-d349-e5e9-6d33abca259b@postgrespro.ru>

* 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