X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C6EA49DC9BE for ; Thu, 5 Jan 2006 11:14:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02928-03 for ; Thu, 5 Jan 2006 11:14:36 -0400 (AST) Received: from pgfoundry.org (pgfoundry.org [200.46.204.130]) by postgresql.org (Postfix) with ESMTP id 2CEB79DC945 for ; Thu, 5 Jan 2006 11:14:30 -0400 (AST) Received: from localhost (av.hub.org [200.46.204.144]) by pgfoundry.org (Postfix) with ESMTP id B541A1033E22; Thu, 5 Jan 2006 15:14:35 +0000 (GMT) Received: from pgfoundry.org ([200.46.204.130]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00178-05; Thu, 5 Jan 2006 11:14:33 -0400 (AST) Received: by pgfoundry.org (Postfix, from userid 80) id 1B25E1033E07; Thu, 5 Jan 2006 15:14:32 +0000 (GMT) To: noreply@pgfoundry.org From: Subject: [ psqlodbc-Bugs-1000498 ] rollback to savepoint in case of error Content-type: text/plain; charset=UTF-8 Message-Id: <20060105151433.1B25E1033E07@pgfoundry.org> Date: Thu, 5 Jan 2006 15:14:32 +0000 (GMT) X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-0.758 required=5 tests=[ALL_TRUSTED=-1.44, AWL=0.132, NO_REAL_NAME=0.55] X-Spam-Score: -0.758 X-Spam-Level: X-Archive-Number: 200601/25 X-Sequence-Number: 6840 Bugs item #1000498, was opened at 2005-12-21 14:19 You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000498&group_id=1000125 Category: None Group: None >Status: Closed 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: Tom Zschockelt (toz) Date: 2006-01-05 15:14 Message: I've testet the new development snapshot 08.01.0106 and it works. I think the bug is fixed. I'll close this bug report. ---------------------------------------------------------------------- Comment By: Ludek Finstrle (luf) Date: 2005-12-24 10: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 09: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 19: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 18: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