Re: On_error_stop - Mailing list pgsql-novice

From Sibte Abbas
Subject Re: On_error_stop
Date
Msg-id bd6a35510707051448h685ce0ddx816baf58ffd7caed@mail.gmail.com
Whole thread Raw
In response to On_error_stop  ("Ashish Karalkar" <ashish.karalkar@info-spectrum.com>)
List pgsql-novice
On 7/3/07, Ashish Karalkar <ashish.karalkar@info-spectrum.com> wrote:
>
>
> Hello All,
>
> I want to run few DDL's from scripts and want the script to halt if any
> error ocuurs, this can be done by on_error_stop
>
> But what I want to do is to display a message something like
>
> If on_error_stop =1
>  {
>     echo "DDL failed";
>     exit();
> }
>
> else "DDL passed";
>
> end
>
> is there any way to do this?
>
> Thanks in advance
> Ashish...
>

AFAIK you cannot write conditional logic within psql.

Similar behavior however can be achieved if you run the sql script
from within a shell script (via psql) and then check the result status
of that command.

regards,
--
Sibte Abbas
EnterpriseDB http://www.enterprisedb.com

pgsql-novice by date:

Previous
From: Jon Sime
Date:
Subject: Re: subquery with more than one column
Next
From: Raimon Fernandez
Date:
Subject: Re: subquery with more than one column