"Simon Riggs" <simon@2ndquadrant.com> writes:
> On Wed, 2006-12-06 at 14:25 -0500, Tom Lane wrote:
>> , but seeing
>> that -c can only issue a single command, implementing ON_ERROR_STOP
>> for it seems like largely a waste of effort.
> The main point is that rc=1 doesn't always mean the same thing, which
> makes it harder to write scripts that handle errors correctly.
You seem to be assuming that -c input should be treated exactly like
script input, which it is not and never has been --- eg, it's not
pre-split at semicolons before submission to the backend. In a green
field doubtless we'd make them more alike, but at this point we really
can't close the gap without risking subtle breakage of people's scripts.
So I don't feel a strong need to make them more consistent on this point
either. The return codes *are* consistent as long as you compare apples
to apples. If you expect -c to be exactly interchangeable with script
input then you're going to get burnt on a lot more than this.
regards, tom lane