Re: Query Window: keep going after error

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Laurent Duperval <lduperval(at)yahoo(dot)com>
Cc: pgadmin-support(at)postgresql(dot)org
Subject: Re: Query Window: keep going after error
Date: 2008-02-09 11:55:49
Message-ID: 47AD94C5.4040504@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

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(at)iol(dot)ie
---------------------------------------------------------------

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Mike Blackwell 2008-02-09 14:22:23 Character encoding conversion
Previous Message Adam Taft 2008-02-08 15:40:19 Re: Timestamp Length or Precision Bug