From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Simon Riggs <simon(at)2ndquadrant(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: psql return codes |
Date: | 2006-12-06 14:53:17 |
Message-ID: | 200612061453.kB6ErHN26002@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Simon Riggs wrote:
> Currently, if we issue this command
>
> psql --set ON_ERROR_STOP= -f f.sql
>
> where f.sql has "select * from foo;"
> then psql will return
> 0 if foo exists
> 3 if foo does not exist (or other SQL error)
>
> Whereas
> psql --set ON_ERROR_STOP= -c "select * from foo;"
> returns
> 0 if foo exists
> 1 if foo does not exist (or other SQL error)
>
> Is this a minor oversight, or some aspect of design?
Well, our psql manual page has:
EXIT STATUS
psql returns 0 to the shell if it finished normally, 1 if
a fatal error of its own (out of memory, file not found)
occurs, 2 if the connection to the server went bad and the
session was not interactive, and 3 if an error occurred in
a script and the variable ON_ERROR_STOP was set.
Were you asking if this behavior is documented, or if it is desirable?
--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2006-12-06 15:00:29 | Re: postgresql roadmap for horizontal scalability? |
Previous Message | Peter Eisentraut | 2006-12-06 14:50:33 | Lock for table renaming |