Re: psql man page error?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: psql man page error?
Дата
Msg-id 200612051741.kB5Hf0x06888@momjian.us
обсуждение исходный текст
Ответ на psql man page error?  ("Simon Riggs" <simon@2ndquadrant.com>)
Ответы Re: psql man page error?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: psql man page error?  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-docs
Simon Riggs wrote:
>
> On the psql man page there is an example of how to perform multiple line
> psql script as part of the -c option description.
>
> The example given is
>
>     echo "\x \\ select * from foo;" | psql
>
> which gives
>
>     prompt> echo "\x \\ select * from foo;" | psql
>     Expanded display is on.
>     invalid command \
>
> i.e. doesn't work on bash. With bash the command should be:
>
>     echo -e "\x \n select * from foo;" | psql
>
> which gives
>
>     prompt> echo -e "\x \n select * from foo;" | psql
>     Expanded display is on.
>     ERROR:  relation "foo" does not exist
>
> Does this mean there are multiple forms of the echo command, or is this
> example just wrong?

Intersting.  This example has been around since at least 2002. The SGML
looks like this:

      <application>psql</application>, like this: <literal>echo "\x \\
      select * from foo;" | psql</literal>.

and I suppose the asumption was that the \\ would be at the end of the
output line, but in fact both HTML and manual pages just put the \\
anywhere on the line.  I think the proper fix is:

      <application>psql</application>, like this: <literal>echo -e
      "\\x\nSELECT * FROM foo;" | psql</literal>.

I think all modern operating systems understand echo -e at this point.
Change applied to HEAD and 8.2.X.

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

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

Предыдущее
От: Jeff Frost
Дата:
Сообщение: Re: psql man page error?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql man page error?