Re: psql variables in the DO command

Поиск
Список
Период
Сортировка
От Pavel Luzanov
Тема Re: psql variables in the DO command
Дата
Msg-id 36771268-3624-8f20-9e31-6598c15a1ee8@postgrespro.ru
обсуждение исходный текст
Ответ на Re: psql variables in the DO command  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: psql variables in the DO command
Список pgsql-general
On 05.03.2018 18:01, Pavel Stehule wrote:

It is most correct when you thinking about it.

1. :xx is out of SQL syntax, so can by safely used. There is not risk of unwanted usage.
But there is absence of wanted usage too.

2. but string literal can contain :xxx symbols and not necessary it means so it should be usage of psql variable - so additional syntax for disabling evaluation should be necessary
Yes and Oracle sqlplus (I khow than you know this tool) has special command to control this: set define ...


Unfortunately DO command is half baked - and doesn't support parameters. I am working on schema variables and I hope it will be a solution of this issue:

CREATE VARIABLE var as integer;

LET var = :psqlintvar;

DO $$
BEGIN
  RAISE NOTICE '%', var;
END;
$$;


It will be great. I already commented it in your blog.

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

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

Предыдущее
От: Murtuza Zabuawala
Дата:
Сообщение: Re: What is wrong with my pgadmin?
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: psql variables in the DO command