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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Browne <cbbrowne(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Make "psql -1 < file.sql" work as with "-f"
Date: 2013-05-10 16:03:19
Message-ID: 8770.1368201799@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christopher Browne <cbbrowne(at)gmail(dot)com> writes:
> On Fri, May 10, 2013 at 9:50 AM, Peter Eisentraut <peter_e(at)gmx(dot)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(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-05-10 16:31:19 Re: corrupt pages detected by enabling checksums
Previous Message Simon Riggs 2013-05-10 15:50:39 Re: Concurrent HOT Update interference