From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
Cc: | Aleksey Tsalolikhin <atsaloli(dot)tech(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6117: psql -c does not work as expected. a documentation bug? a program bug? |
Date: | 2011-07-14 15:34:54 |
Message-ID: | 29983.1310657694@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Craig Ringer <craig(at)postnewspapers(dot)com(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2011-07-14 16:45:08 | Re: Spurious errors relating to escaped single quotes |
Previous Message | Gavin Flower | 2011-07-14 11:45:00 | Spurious errors relating to escaped single quotes |