Re: [PATCH] Make "psql -1 < file.sql" work as with "-f"

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christopher Browne <cbbrowne@gmail.com>
Cc: Peter Eisentraut <peter_e@gmx.net>, Robert Haas <robertmhaas@gmail.com>, David Fetter <david@fetter.org>, Fabien COELHO <coelho@cri.ensmp.fr>, PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2013-05-10T16:03:19Z
Lists: pgsql-hackers
Christopher Browne <cbbrowne@gmail.com> writes:
> On Fri, May 10, 2013 at 9:50 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
>> My first use of 9.3beta1 in development failed because of changes
>> introduced by this patch, specifically because of the newly introduced
>> error
>> 
>> psql: -1 is incompatible with -c and -l
>> 
>> I'm not convinced this is correct.  -c and -l are single-transaction
>> actions almost by definition.
>> 
>> This particular aspect of the change wasn't really brought up in the
>> original thread.  What was your thinking?

> I'm not sure I agree with you vis-a-vis the -c option, as it is certainly
> plausible/meaningful
> to do:
>   psql -c "begin; update [something]; insert [something]; delete
> [something]; commit;"
> and for that to be different from
>   psql -c "update [something]; insert [something]; delete [something];"

While it might be *plausible* for those to be different, that's not
actually how -c works in practice, because it sends the string as a
single PQexec, which has the effect of making the string a single
transaction even if the string does not contain begin/end explicitly.

I think Peter is right and this error is bogus.  Whatever redeeming
social value it might have for sticklers is not worth breaking existing
apps for.

			regards, tom lane


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