Обсуждение: Query Window: keep going after error

Поиск
Список
Период
Сортировка

Query Window: keep going after error

От
Laurent Duperval
Дата:
Hi,

I am currently testing some SQL scripts and I want to run the entire
script, even if there is an error in it. Currently, it stops when there is
an error and does not execute any of the commands in the SQL file.

How can I do this?

Thanks,

L

-- 
Prenez la parole en public en étant         Speak to an audience while being
moins nerveux et plus convaincant!         less nervous and more convincing!
Abonnez-vous au bulletin gratuit!           Sign up for the free newsletter!
                http://www.duperval.com   (514) 902-0186



Re: Query Window: keep going after error

От
Raymond O'Donnell
Дата:
On 07/02/2008 15:30, Laurent Duperval wrote:

> I am currently testing some SQL scripts and I want to run the entire
> script, even if there is an error in it. Currently, it stops when there is
> an error and does not execute any of the commands in the SQL file.

At a guess, I'd say that this is because of the way PostgreSQL works, 
not PgAdmin - when you execute a series of statements within a 
transaction, and one of them causes an error, no following statements 
will be executed until you ROLLBACK the transaction. Scripts from from 
the Query Editor in PgAdmin are run within a transaction, so this is the 
behaviour you are seeing.

If you want your script to continue after an error (and to be honest I 
can't think of many cases where you would :-) ) you should run it from 
psql, perhaps using the \i command (which runs the contents of an 
external file).

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------