dbTalk Databases Forums  

Excuting SQL-Statements after error in same transaction ?

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Excuting SQL-Statements after error in same transaction ? in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael Kleiser
 
Posts: n/a

Default Excuting SQL-Statements after error in same transaction ? - 06-18-2004 , 05:28 AM






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 ?





---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #2  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: Excuting SQL-Statements after error in same transaction ? - 06-18-2004 , 10:06 AM






On Fri, Jun 18, 2004 at 12:28:25 +0200,
Michael Kleiser <mkl (AT) webde-ag (DOT) de> wrote:
Quote:
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:
Right now you can't. This will probably be possible in 7.5 as it looks
like there will be a nested transaction capability in 7.5. In about
two weeks there will be a more definite answer. Shortly after there should
be a 7.5 beta for you to play with. Look for 7.5 to be released sometime
this fall.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.