Re: psql --command option ignores --variable's

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: psql --command option ignores --variable's
Дата
Msg-id 15685.1378134050@sss.pgh.pa.us
обсуждение исходный текст
Ответ на psql --command option ignores --variable's  (Tim Kane <tim.kane@gmail.com>)
Список pgsql-general
Tim Kane <tim.kane@gmail.com> writes:
> It seems the behaviour of the --command / -c option is such that it will
> ignore any variables set on the command-line.

If memory serves, the string given to -c is just fired off to the server
as-is.  It's not broken into separate commands, and I think we don't do
substitutions on it either, which would explain this result.

There have been some discussions of trying to make it work more like
processing of normal input would do, but people are too afraid of breaking
existing applications by changing the semantics.

I'd suggest something like

echo 'select :TESTVAR;' | psql --variable TESTVAR='123'

            regards, tom lane


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

Предыдущее
От: Tim Kane
Дата:
Сообщение: psql --command option ignores --variable's
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: psql --command option ignores --variable's