Re: psql variables in the DO command

From: Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: psql variables in the DO command
Date: 2018-03-05 13:52:32
Message-ID: f80e9cbb-75e8-d349-e5e9-6d33abca259b@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2018-03-05 13:56:22 Re: psql variables in the DO command
Previous Message Pavel Stehule 2018-03-05 13:42:15 Re: psql variables in the DO command