Re: psql man page error?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: psql man page error?
Date: 2006-12-05 17:41:00
Message-ID: 200612051741.kB5Hf0x06888@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2006-12-05 18:14:45 Re: psql man page error?
Previous Message Jeff Frost 2006-12-05 17:22:36 Re: psql man page error?