Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
Date
Msg-id 29983.1310657694@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?  (Craig Ringer <craig@postnewspapers.com.au>)
Responses Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug?
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: John R Pierce
Date:
Subject: Re: BUG #6118: Server doesn't listen
Next
From:
Date:
Subject: Re: BUG #6118: Server doesn't listen