Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDzXP-0002sB-Mk for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Feb 2014 16:53:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WDzXP-0002M9-20 for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Feb 2014 16:53:23 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDzXO-0002M2-2O for pgsql-bugs@postgresql.org; Thu, 13 Feb 2014 16:53:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDzXL-0000eT-G6 for pgsql-bugs@postgresql.org; Thu, 13 Feb 2014 16:53:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s1DGrIpH005467; Thu, 13 Feb 2014 11:53:18 -0500 From: Tom Lane To: David Johnston cc: pgsql-bugs@postgresql.org Subject: Re: BUG #9198: psql -c 'SET; ...' not working In-reply-to: <1392307160231-5791870.post@n5.nabble.com> References: <20140212125626.2710.94912@wrigleys.postgresql.org> <25094.1392219652@sss.pgh.pa.us> <1392307160231-5791870.post@n5.nabble.com> Comments: In-reply-to David Johnston message dated "Thu, 13 Feb 2014 07:59:20 -0800" Date: Thu, 13 Feb 2014 11:53:18 -0500 Message-ID: <5466.1392310398@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org David Johnston 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 <