Re: BUG #9198: psql -c 'SET; ...' not working

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #9198: psql -c 'SET; ...' not working
Дата
Msg-id 5466.1392310398@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #9198: psql -c 'SET; ...' not working  (David Johnston <polobo@yahoo.com>)
Список pgsql-bugs
David Johnston <polobo@yahoo.com> writes:
> I'm dubious this would be much of a realistic improvement in ease-of-use -
> at least in the Linux/bash world where you are much better off constructing
> some form of here-doc - and passing that in via standard input - if you need
> to make use of multiple statements and usually want white-space to make
> reading/maintaining those statements easier.

Yeah.  The psql man page fails to suggest here-documents in this context,
which seems like rather an oversight.  Perhaps what we should do is add
something like this to the description of -c:

    Because of these legacy behaviors, passing more than one command to -c
    often has unexpected results.  It's better to feed multiple commands
    to psql's standard input, either using "echo" as illustrated above,
    or via a shell here-document, for example

    psql <<EOF
    \x
    SELECT * FROM foo
    EOF

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #9198: psql -c 'SET; ...' not working
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #9204: truncate_identifier may be called unnecessarily on escaped quoted identifiers