On Wed, 2006-12-06 at 14:25 -0500, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Jim C. Nasby wrote:
> >> Why should it matter if the "SELECT * FROM foo" came to
> >> psql via -f or -c?
>
> > Well, it explains exactly what Simon was seeing. I agree it is strange,
> > but I was asking if Simon knew it was documented.
Yes, but it doesn't say what a "script" is and doesn't explain either.
> I assume the "3" is
> > used to report a different error from 'file not found' or something.
>
> Well, the real point here is that ON_ERROR_STOP doesn't apply to
> interactive input, and -c is evidently being considered to be
> interactive. You could argue that either way I suppose
I'm all ears...
> , 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.
It may be a small thing, but that doesn't make it right.
-- Simon Riggs EnterpriseDB http://www.enterprisedb.com