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

Re: Continue transactions after errors in psql

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Continue transactions after errors in psql
Date: 2005-04-25 16:34:00
Message-ID: 200504251634.j3PGY0Z11527@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Greg Sabino Mullane wrote:
[ There is text before PGP section. ]
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> Finally had a chance to sit down at look at this afresh, and I'm
> pretty sure I've got all the kinks worked out this time. Apologies
> for not attaching, but my mail system is not working well enough
> at the moment. So, please try to break this patch:
> 
> http://www.gtsm.com/pg/psql_error_recovery.diff

I have modified Greg's patch to fit in better with the existing psql
code.  I changed the command to \set ON_ERROR_ROLLBACK, which seems to
fit better.  Here is an illustration of its use (patch attached):
	
	test=> BEGIN;
	BEGIN
	test=> lkjasdf;
	ERROR:  syntax error at or near "lkjasdf" at character 1
	LINE 1: lkjasdf;
	        ^
	test=> SELECT 1;
	ERROR:  current transaction is aborted, commands ignored until end of
	transaction block
	test=> COMMIT;
	ROLLBACK
	test=> \set ON_ERROR_ROLLBACK on
	test=> BEGIN;
	BEGIN
	test=> lkjasdf;
	ERROR:  syntax error at or near "lkjasdf" at character 1
	LINE 1: lkjasdf;
	        ^
	test=> SELECT 1;
	 ?column?
	----------
	        1
	(1 row)
	
	test=> COMMIT;
	COMMIT

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2005-04-25 16:39:37
Subject: Re: Continue transactions after errors in psql
Previous:From: Dave HeldDate: 2005-04-25 16:15:22
Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested?

pgsql-patches by date

Next:From: Alvaro HerreraDate: 2005-04-25 16:39:37
Subject: Re: Continue transactions after errors in psql
Previous:From: Bruce MomjianDate: 2005-04-25 04:40:10
Subject: Re: Cleaning up unreferenced table files

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