Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 0D5209FA103 for ; Wed, 6 Dec 2006 00:29:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 75048-08 for ; Wed, 6 Dec 2006 00:29:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from momjian.us (momjian.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 62E609F9386 for ; Wed, 6 Dec 2006 00:29:44 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id kB64Tfa16970; Tue, 5 Dec 2006 23:29:41 -0500 (EST) From: Bruce Momjian Message-Id: <200612060429.kB64Tfa16970@momjian.us> Subject: Re: psql man page error? In-Reply-To: <1165361142.3839.281.camel@silverbirch.site> To: Simon Riggs Date: Tue, 5 Dec 2006 23:29:41 -0500 (EST) CC: Tom Lane , pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL123] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/12 X-Sequence-Number: 3935 Simon Riggs wrote: > On Tue, 2006-12-05 at 18:16 -0500, Bruce Momjian wrote: > > Tom Lane wrote: > > > Bruce Momjian writes: > > > > I think the proper fix is: > > > > > > > psql, like this: echo -e > > > > "\\x\nSELECT * FROM foo;" | psql. > > > > > > > I think all modern operating systems understand echo -e at this point. > > > > > > No, they don't, and neither does the Single Unix Spec: > > > http://www.opengroup.org/onlinepubs/007908799/xcu/echo.html > > > > > > So your version of the example depends on non-standards-compliant > > > echo behavior, which is not better than before. > > > > Well, at least my example works on _some_ operating systems, while the > > previous worked on none of them, so it is _better_. > > > > I can't think of a good way to do this except converting the example to > > a block that will not change newlines: > > > > echo '\x > > SELECT * FROM foo;' | psql > > > > Is that what people want? > > Well, it works, but IMHO its not as clear. Well, it is even worse because some versions of echo automatically interpret backslashes, so it would have to be \\x. I am thinking we should just leave it as I have it now, unless we want to use 'awk' or 'perl' where we know the backslash behavior. -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +