Re: psql exit code

From: Richard Huxton <dev(at)archonet(dot)com>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: psql exit code
Date: 2008-11-10 10:56:57
Message-ID: 49181379.6060702@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-11-10 11:15:51 Re: psql exit code
Previous Message Ivan Sergio Borgonovo 2008-11-10 10:43:08 psql exit code