Re: Using psql variables in DO-blocks

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Using psql variables in DO-blocks
Дата
Msg-id CAKFQuwY381xD9u32CSFRwizpApsFUf082CW1yBLJJ062DZifDg@mail.gmail.com
обсуждение исходный текст
Ответ на Using psql variables in DO-blocks  (Andreas Joseph Krogh <andreas@visena.com>)
Список pgsql-general
On Tue, Jan 15, 2019 at 8:48 AM Andreas Joseph Krogh <andreas@visena.com> wrote:
Hi all.
 
I'm trying to use a psql variable in a DO-block, but it fails:
 [...]
Any hints?

Don't do that.  The body of a DO block is a string literal and psql won't and shouldn't mess with its contents.  You'll need to use an actual function and pass in the psql variable data via an input parameter.

set_config(...)/current_setting(...) is another option to consider.

David J.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Refining query statement
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Sv: Using psql variables in DO-blocks