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

Excuting SQL-Statements after error in same transaction ?

From: Michael Kleiser <mkl(at)webde-ag(dot)de>
To: "[NOVICE]" <pgsql-novice(at)postgresql(dot)org>
Subject: Excuting SQL-Statements after error in same transaction ?
Date: 2004-06-18 10:28:25
Message-ID: 40D2C3C9.9000605@webde-ag.de (view raw or flat)
Thread:
Lists: pgsql-novice
I'm tying to estimate the expense of migrating some application from Oracle to PostgreSQL
I'm happy to see, that there are many simmilarities in SQL and PostgreSQl has also all kinds of DML-triggers.

But one difference twould lead into much reprogramming:
If there is an error in a transaction, I can't execute any further sql-statements in tge same transaction.
I the existing code I have many expected errors like in this example:

mkl=> BEGIN;
BEGIN
mkl=> insert into categories ( id, user_id, name, name_lc ) values ( 10002, 4711, 'FOO', 'foo' );
ERROR:  duplicate key violates Unique-Constraint »pk_categories«
mkl=> udpate categories set user_id=4711, name='FOO', name_lc='foo' WHERE id=10002;
ERROR:  Fehler »syntax error« bei »udpate« at character 1
mkl=> update categories set user_id=4711, name='FOO', name_lc='foo' WHERE id=10002;
ERROR:  actual tranaction aborded, commands are ignoord until the end of the transaction

(error-mesages translated by hand into english)

Is ist possible to change this behavior p.e with a SET-command ?





Responses

pgsql-novice by date

Next:From: Bruno Wolff IIIDate: 2004-06-18 15:06:15
Subject: Re: Excuting SQL-Statements after error in same transaction ?
Previous:From: Pradeepkumar, Pyatalo (IE10)Date: 2004-06-18 06:42:11
Subject: Help with returning affected rows from a function

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