pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Johnston <polobo@yahoo.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #9198: psql -c 'SET; ...' not working
Date: Thu, 13 Feb 2014 11:53:18 -0500
Message-ID: <5466.1392310398@sss.pgh.pa.us> (raw)
In-Reply-To: <1392307160231-5791870.post@n5.nabble.com>
References: <20140212125626.2710.94912@wrigleys.postgresql.org>
	<25094.1392219652@sss.pgh.pa.us>
	<CAJghg4Lo5t8jab6NnrLOnM9A2LNH_zajD_7TegiPCSvSGdqUDA@mail.gmail.com>
	<1392307160231-5791870.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (9+ messages)

Message-ID: <5466.1392310398@sss.pgh.pa.us>
Permalink:  ../5466.1392310398@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5466.1392310398@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, polobo@yahoo.com
  Subject: Re: BUG #9198: psql -c 'SET; ...' not working
  In-Reply-To: <5466.1392310398@sss.pgh.pa.us>
  References: <20140212125626.2710.94912@wrigleys.postgresql.org> <25094.1392219652@sss.pgh.pa.us> <CAJghg4Lo5t8jab6NnrLOnM9A2LNH_zajD_7TegiPCSvSGdqUDA@mail.gmail.com> <1392307160231-5791870.post@n5.nabble.com> <5466.1392310398@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox