stopping execution of a script (on error)

Started by ochapiteaualmost 25 years ago2 messagesgeneral
Jump to latest
#1ochapiteau
ochapiteau@cyberdeck.net

Is it possible to stop the execution of a sql script in case of problem ?

ex :

create table newtable as select * from oldtable
DROP TABLE oldtable

I don't want to drop the table if the first instruction did not work properly

#2Peter Eisentraut
peter_e@gmx.net
In reply to: ochapiteau (#1)
Re: stopping execution of a script (on error)

Olivier Chapiteau writes:

Is it possible to stop the execution of a sql script in case of problem ?

ex :

create table newtable as select * from oldtable
DROP TABLE oldtable

I don't want to drop the table if the first instruction did not work properly

In psql:

\set ON_ERROR_STOP

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter