From: Tom Lane <tgl@sss.pgh.pa.us>
To: Craig Ringer <craig@postnewspapers.com.au>
Cc: Aleksey Tsalolikhin <atsaloli.tech@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
Date: Thu, 14 Jul 2011 11:34:54 -0400
Message-ID: <29983.1310657694@sss.pgh.pa.us> (raw)
In-Reply-To: <4E1E5014.2080101@postnewspapers.com.au>
References: <201107132053.p6DKrmmV052152@wwwmaster.postgresql.org>
<4E1E5014.2080101@postnewspapers.com.au>
Craig Ringer <craig@postnewspapers.com.au> writes:
> What's happening is that all of them are processed, but only the output
> for the last one is emitted. I agree that the documentation isn't clear
> about that, and I'm not sure whether or not that was the intended result.
> ...
> Comments anybody? Just fix the docs, or is this a behaviour issue?
This is a byproduct of the fact that psql shoves the -c string out to
the backend as a single Query message, rather than splitting it at
semicolons and sending each command individually, which is what would
happen if you typed a multi-command line normally.
That has a bunch of indirect semantic implications, like the commands
all being done in one transaction and execution of the whole thing
always being abandoned after the first error.
We've talked many times about changing that, but always been too afraid
of breaking user scripts that rely on the current behavior.
We could possibly address Aleksey's complaint without changing the
behavior otherwise, but I'm not sure it's worth the trouble. So I
vote for document-and-move-on.
regards, tom lane
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, craig@postnewspapers.com.au, atsaloli.tech@gmail.com
Subject: Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
In-Reply-To: <29983.1310657694@sss.pgh.pa.us>
References: <201107132053.p6DKrmmV052152@wwwmaster.postgresql.org> <4E1E5014.2080101@postnewspapers.com.au> <29983.1310657694@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