X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 155DFD77EB for ; Sun, 4 Sep 2005 13:44:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19834-06 for ; Sun, 4 Sep 2005 16:44:33 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.205]) by svr1.postgresql.org (Postfix) with ESMTP id 17241D7125 for ; Sun, 4 Sep 2005 13:44:27 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id z6so493232nzd for ; Sun, 04 Sep 2005 09:44:11 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=mky56eOUjk8ww9zqRte2DDdYtlRJV3I72GFzVv95UOqngsZWFbhEQRsK2gZ2qH28Xk3ZI4uC+HePsP1aMu6y9t4ksJm99IwDy7dqKkXnYR3AgrXhyfjYfm7DcOwRy6P6fTGk98v6tepzZ8hcwlOms3v816wlnmN3yzdB2aZ6p4E= Received: by 10.36.119.11 with SMTP id r11mr3907871nzc; Sun, 04 Sep 2005 09:44:11 -0700 (PDT) Received: by 10.36.247.45 with HTTP; Sun, 4 Sep 2005 09:44:11 -0700 (PDT) Message-ID: Date: Sun, 4 Sep 2005 13:44:11 -0300 From: Cleber Nardelli Reply-To: clebernardelli@gmail.com To: Marko Ristola Subject: Re: Transactions and SavePoints Cc: pgsql-odbc@postgresql.org In-Reply-To: <4319604D.4040809@kolumbus.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050831115735.91661.qmail@web53206.mail.yahoo.com> <4315DB11.8050300@kolumbus.fi> <43174D49.5010008@kolumbus.fi> <4319604D.4040809@kolumbus.fi> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 required=5 tests=[AWL=0.021, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200509/45 X-Sequence-Number: 5943 Hi.... =20 I find that I am not accustomed with this business of CVS. =20 I do not understand inside.... of pgfoundry I exist the option of if to see the tree of the CVS (historical), I obtain to see the modifications made in the archives, but the option of compilation of the current version I did not find. It will be that you it could also give an aid to me in this... =20 Thank you... =20 Cleber. 2005/9/3, Marko Ristola : >=20 > Hi. >=20 > Unfortunately I don't have a Windows compilation environment for > building the driver either. >=20 > Hiroshi Saito and Dave Page made a good fix based on my solution > below. The fix is in CVS now. >=20 > Maybe somebody else on this list can compile the latest version > of the development driver or the stable driver with this fix > with the patch for you. >=20 > Regards, > Marko Ristola >=20 > Cleber Nardelli wrote: >=20 > >Hi... > >Marko, debtor for the aid. > >Not wanting to ask for very, but it would like to lher to ask for of > >the same skill..... I already I had given one looked at in the sources > >of driver and more or less had identified the problem, ok, but it > >happens that I I do not have much knowledge in C and I do not obtain > >to compile driver, will be that you it could not make this for me? > > > >In any obliged way > > > >Cleber > > > >2005/9/1, Marko Ristola : > > > > > >>Unfortunately SAVEPOINT support has not been implemented > >>into psqlodbc driver yet. > >> > >>So it doesn't work unfortunately. > >> > >>However, if you have a possibility use the native PostgreSQL > >>libpq driver (not an ODBC driver) instead, > >>you can use fully featured savepoints. > >> > >>Depending on your needs, you can even pay > >>somebody to implement the feature into psqlodbc. A good enough > >>implementation could be included into the driver. > >> > >>I have a small part of an implementation, but that's not enough. > >> > >>You described your problem: the ODBC driver does the rollback > >>for you, even though you don't want it. > >> > >>The problem is just the ice berg of the lack of the > >>SAVEPOINT feature in the psqlodbc driver. > >> > >> > >>However, I know one easy solution into the problem, you found: > >> > >>Get source code of the psqlodbc ODBC driver. > >> > >>On file connection.c, C code function CC_send_query(): > >> > >> else if (strnicmp(cmdbuffer, "ROLLBACK", 8) =3D=3D 0) > >> CC_on_abort(self, NO_TRANS); > >> > >>The above must be changed not to call CC_on_abort(self,NO_TRANS), if th= e > >>case > >>is "ROLLBACK TO SAVEPOINT name"; > >>CC_on_abort(self,NO_TRANS); must be called on "ROLLBACK WORK" > >> > >>NO_TRANS means, that the ODBC thinks, that there is no transaction in t= he > >>PostgreSQL server. > >> > >>So you can get your problem away with: > >> > >> else if (strnicmp(cmdbuffer, "ROLLBACK", 8) =3D=3D 0 && > >>(strnicmp(query,"ROLLBACK TO",11) !=3D 0) > >> CC_on_abort(self, NO_TRANS); > >> > >>I used "query" argument, because cmdbuffer is "ROLLBACK", but query is > >>"ROLLBACK TO SAVEPOINT name". > >> > >>Then you need to recompile the ODBC driver, and you don't have that > >>problem anymore. > >>ODBC debugging options help you to track further problems with savepoin= ts. > >> > >>With this, only a partial SAVEPOINT implementation can be achieved. > >>You might get well with SAVEPOINTs, if you don't use CURSORs, > >>because with them the problem becomes a lot harder, and the simple > >>fix from above won't work anymore. > >> > >>Yours, > >>Marko Ristola > >> > >>Cleber Nardelli wrote: > >> > >> > >> > >>>Marko, debtor for the aid that you have given me. > >>> > >>>My problem in the truth nor is SAVEPOINT and ROLLBACK You the SAVEPOIN= T. > >>> > >>>My problem is that when an error is generated during the execution of > >>>commands inside of a transaction driver automatically it makes a > >>>ROLLBACK of all the executed commands until then and ai I do not > >>>obtain to execute the ROLLBACK You the SAVEPOINT therefore the block > >>>of the transaction already does not exist more. > >>> > >>>Yours truly Cleber > >>> > >>>2005/8/31, Marko Ristola : > >>> > >>> > >>> > >>> > >>>>Hi > >>>> > >>>>I tried to write SAVEPOINT SQL support into PsqlODBC in Summer. > >>>> > >>>>I was able to implement some suport for savepoint creation, savepoint > >>>>rollback and savepoint RELEASE. > >>>> > >>>>I didn't understand, how the query results should behave at savepoint > >>>>rollbacks. > >>>> > >>>>You can find more information about my thoughts about savepoint > >>>>implementation on this list ealier this year, or with Google. > >>>> > >>>>Main design issue was, that SAVEPOINT tracking must be implemented > >>>>into PSQLODBC. > >>>> > >>>>That's what I implemented: > >>>>- Linked list of all defined savepoints. > >>>>- Maintain the list during SAVEPOINT maintenance functions. > >>>> > >>>>Savepoint command parsing speed was 600000 commands per second, > >>>>that I wrote (UTF-8). With UCS-4 , without a state machine, it was > >>>>300000 commands per second. The subsystem's speed was okay. > >>>> > >>>>I implemented a full PostgreSQL SQL SAVEPOINT support with > >>>>the Bison/Flex parser, because it is easy, but that part is > >>>>not at all easy to integrate into an existing PsqlODBC driver. > >>>> > >>>>Are you interested in a patch for the mergeable part of the savepoint > >>>>support? > >>>> > >>>>Regards, > >>>>Marko Ristola > >>>> > >>>>Carlos Henrique Reimer wrote: > >>>> > >>>> > >>>> > >>>> > >>>> > >>>>>Is there a ODBC flavor than can implement ROLLBACK TO SAVEPOINT? > >>>>> > >>>>>Marko Ristola wrote: > >>>>> > >>>>> > >>>>> > >>>>> > >>>>>>Unfortunately SAVEPOINTs are not implemented in PsqlODBC yet. > >>>>>> > >>>>>> > >>>>>>ROLLBACK TO SAVEPOINT -case is easy to fix, but the full > >>>>>>implementation is hard to make correctly for psqlodbc, at least for= me. > >>>>>> > >>>>>>Marko Ristola > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>>>Cleber Nardelli wrote: > >>>>>>> > >>>>>>> > >>>>>>>Hello. > >>>>>>>I am using the Driver odbc for access to postgresql. I have a > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>referring problem to the cancellation of the transaction when > >>>>> > >>>>> > >>>>> > >>>>> > >>>>>>>some error > >>>>>>>is found at the moment of the execution of the same one. I try to > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>execute this sql command: > >>>>> > >>>>> > >>>>> > >>>>> > >>>>>>>BEGIN TRANSACTION; > >>>>>>>DELETE FROM TABL1 WHERE ID =3D 1; > >>>>>>>INSERT INTO TABL1 VALUES (1,1); > >>>>>>>SAVEPOINT SVPT; > >>>>>>>INSERT INTO TABL1 VALUES (1,1); > >>>>>>>ROLLBACK TO SAVEPOINT SPVT; > >>>>>>>COMMIT; > >>>>>>> > >>>>>>>When I try to insert as register it accuses to error with key > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>duplicate. Ok. But I do not want to cancel the transaction I I need = to > >>>>>only continue > >>>>> > >>>>> > >>>>> > >>>>> > >>>>>>>with the same one skirting this error. For this reason I am using > >>>>>>>SavePoints but it generates the error: > >>>>>>>"ERROR: ROLLBACK TO SAVEPOINT may only be used in transaction bloc= ks" > >>>>>>> > >>>>>>>Necessary of the your help. I thank > >>>>>>> > >>>>>>>Yours truly > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>--------------------------------------------------------------------= ---- > >>>>>Yahoo! Acesso Gr=E1tis > >>>>><%20http://us.rd.yahoo.com/mail/br/taglines/*http://br.acesso.yahoo.= com/>: > >>>>>Internet r=E1pida e gr=E1tis. Instale o discador agora! > >>>>><%20http://us.rd.yahoo.com/mail/br/taglines/*http://br.acesso.yahoo.= com/> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>---------------------------(end of broadcast)------------------------= --- > >>>>TIP 3: Have you checked our extensive FAQ? > >>>> > >>>> http://www.postgresql.org/docs/faq > >>>> > >>>> > >>>> > >>>> > >>>> > >>> > >>> > >>> > >>> > >> > >> > > > > > > > > >=20 >=20 --=20 Cleber Nardelli IPM Automa=E7=E3o e Consultoria 9998-8670