Skip site navigation (1) Skip section navigation (2)

Re: On_error_stop

From: "Sibte Abbas" <sibtay(at)gmail(dot)com>
To: "Ashish Karalkar" <ashish(dot)karalkar(at)info-spectrum(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: On_error_stop
Date: 2007-07-05 21:48:43
Message-ID: (view raw or whole thread)
Lists: pgsql-novice
On 7/3/07, Ashish Karalkar <ashish(dot)karalkar(at)info-spectrum(dot)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.

Sibte Abbas

In response to

pgsql-novice by date

Next:From: Raimon FernandezDate: 2007-07-06 06:11:27
Subject: Re: subquery with more than one column
Previous:From: Jon SimeDate: 2007-07-05 21:27:48
Subject: Re: subquery with more than one column

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group