pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: noreply@pgfoundry.org
To: noreply@pgfoundry.org
Subject:  [ psqlodbc-Bugs-1000498 ] rollback to savepoint in case of error
Date: Sat, 24 Dec 2005 10:40:45 +0000 (GMT)
Message-ID: <20051224104045.8B3711125078@pgfoundry.org> (raw)

Bugs item #1000498, was opened at 2005-12-21 15:19
You can respond by visiting: 
http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000498&group_id=1000125

Category: None
Group: None
Status: Open
Resolution: Accepted
Priority: 3
Submitted By: Tom Zschockelt (toz)
Assigned to: Ludek Finstrle (luf)
Summary: rollback to savepoint in case of error

Initial Comment:
the current snapshot driver only supports manual rollback to savepoints
if ( and only if ) all previous statements return with success.

e.g.

My env :

win2003 server
8.1.0 postgresql
psqlodbc 8.01.0105


CREATE TABLE testtable (
f1 int2 primary key,
f2 varchar(10) null);


the following snippet works

BEGIN
INSERT INTO testtable values ( 12, 'hello');
SAVEPOINT SP_INSERT;
INSERT INTO testtable values ( 13, 'hello1');
ROLLBACK TO SAVEPOINT SP_INSERT;
INSERT INTO testtable values ( 13, 'hello123');
COMMIT;

the following snippet don't work

BEGIN
INSERT INTO testtable values ( 12, 'hello');
SAVEPOINT SP_INSERT;
INSERT INTO testtable values ( 12, 'hello1'); <-- auto rollback occurs !!!
ROLLBACK TO SAVEPOINT SP_INSERT;
INSERT INTO testtable values ( 13, 'hello123');
COMMIT;

Why does an error breaks the savepoint environment ?

By now I used an application side workaround as I do an select before 
each insert to check if a certain row already exists in the table.
If it exist I try an update on the row.
( but this is a real performance killer ... )

----------------------------------------------------------------------

>Comment By: Ludek Finstrle (luf)
Date: 2005-12-24 11:40

Message:
Please try new development snapshot 8.01.0106. The problem may be fixed there.

I attach patch. It have to be applied after psqlodbc-sqlstate.diff.

----------------------------------------------------------------------

Comment By: Ludek Finstrle (luf)
Date: 2005-12-23 10:35

Message:
I accept the bug in case autocommit = off => don't take a care on transaction state.

What driver version do you use? Do you use 8.01.0105 patched with SqlState patch?

Could you attach mylog output for second example (the failure one)?

Thanks

----------------------------------------------------------------------

Comment By: Tom Zschockelt (toz)
Date: 2005-12-22 20:17

Message:
I switched autocommit off with the  
SQLSetConnectAttr() Function 
 
See the first example which works well !!! 
 
 

----------------------------------------------------------------------

Comment By: Ludek Finstrle (luf)
Date: 2005-12-22 19:57

Message:
What about autocommit StmtOption? Don't you have autocommit on?
Driver doesn't support savepoints in this case yet.

----------------------------------------------------------------------

You can respond by visiting: 
http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000498&group_id=1000125



view thread (5+ messages)  latest in thread

Message-ID: <20051224104045.8B3711125078@pgfoundry.org>
Permalink:  ../20051224104045.8B3711125078@pgfoundry.org/
Also on:    postgresql.org/message-id/20051224104045.8B3711125078@pgfoundry.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: noreply@pgfoundry.org
  Subject: Re: [ psqlodbc-Bugs-1000498 ] rollback to savepoint in case of error
  In-Reply-To: <20051224104045.8B3711125078@pgfoundry.org>
  References: <20051224104045.8B3711125078@pgfoundry.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox