Re: psql exit code - Mailing list pgsql-general

From Richard Huxton
Subject Re: psql exit code
Date
Msg-id 49181379.6060702@archonet.com
Whole thread Raw
In response to psql exit code  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Responses Re: psql exit code  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-general
Ivan Sergio Borgonovo wrote:
> I'm running:
>
> ON_ERROR_STOP="on" PGPASSFILE="/somewhere" psql dbname username -f
> script.sql
> (or alternatively <script.sql)
>
> echo $?
> always returns 0 even when sql is clearly wrong.

I don't think ON_ERROR_STOP is read from the environment, you need to
define it as a psql variable.

psql -v 'ON_ERROR_STOP=on' ...

That should give you an error code.

--
  Richard Huxton
  Archonet Ltd

pgsql-general by date:

Previous
From: Ivan Sergio Borgonovo
Date:
Subject: psql exit code
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: psql exit code