psql command line variables are unknown when -c SQL statement are executed

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема psql command line variables are unknown when -c SQL statement are executed
Дата
Msg-id 162867790911160119o4e1ce19foc97dc393fb5640c0@mail.gmail.com
обсуждение исходный текст
Ответы Re: psql command line variables are unknown when -c SQL statement are executed  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-bugs
wrong:

pavel@nemesis ~]$ psql postgres -v x=3D10 -c "select :x"
ERROR:  syntax error at or near ":"
LINE 1: select :x
               ^

good (workaround):
[pavel@nemesis ~]$ echo 'select :x' | psql postgres -v x=3D10
 ?column?
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80
       10
(1 row)

psql have to have process external variables first and then execute query.

Regards
Pavel Stehule

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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Multixact and prepared transactions
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: psql command line variables are unknown when -c SQL statement are executed