Re: psql return codes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql return codes
Date: 2006-12-06 20:37:19
Message-ID: 1106.1165437439@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Simon Riggs" <simon(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-12-06 20:59:32 Re: 8.2 bug with outer join reordering
Previous Message Tom Lane 2006-12-06 20:12:54 Re: old synchronized scan patch