Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id AAF38635278 for ; Thu, 2 Apr 2009 13:18:52 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 76155-08-3 for ; Thu, 2 Apr 2009 13:18:47 -0300 (ADT) X-Greylist: delayed 00:17:23.135195 by SQLgrey-1.7.6 Received: from del0801s009.ign.fr (smtp3.ign.fr [192.134.133.7]) by mail.postgresql.org (Postfix) with ESMTP id 396E863588C for ; Thu, 2 Apr 2009 13:11:15 -0300 (ADT) Received: from newsmtp.ign.fr (newpop.ign.fr [172.21.0.149]) by del0801s009.ign.fr (8.13.8/8.13.8/Debian-3) with ESMTP id n32FrnAt019635 for ; Thu, 2 Apr 2009 17:53:51 +0200 Received: from DEL9323970 (del-9323970.ign.fr [172.16.0.113]) by newsmtp.ign.fr (Postfix) with ESMTP id 07C6DD4C454 for ; Thu, 2 Apr 2009 17:53:38 +0200 (CEST) From: "olivier dorie" To: Subject: driver ODBC-PostreSQL, cursor and transaction isolation level Date: Thu, 2 Apr 2009 17:53:51 +0200 Message-ID: <056F3845699645D39CF3C392BD754BEA@ign.fr> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_010A_01C9B3BB.FB293D90" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: Acmzquh+0/3nW87kSKKmyHuF1JQ2yA== X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200904/1 X-Sequence-Number: 9820 This is a multi-part message in MIME format. ------=_NextPart_000_010A_01C9B3BB.FB293D90 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello, I have some problems to have a transaction isolation level serializable with postgresql-ODBC driver for windows by using the ODBC cursor (UseDeclareFetch=1). My database is on PostgreSQL 8.3.7/ Linux. I use the postgresql-ODBC version 8.03.04 for windows. I make this test with the default_transaction_isolation = 'read committed' and after with the default_transaction_isolation = 'serializable' on the server. The results are the same. I do the followings operations in a c++ programm: * I open 2 connections on my database with the ODBC drivers: "connexion1" and "connexion2" * CDatabase * db1 = new CDatabase ; * CDatabase * db2 = new CDatabase * db1->OpenEx (chaine_connection_mydatabase, CDatabase::noOdbcDialog); * db2->OpenEx (chaine_connection_mydatabase, CDatabase::noOdbcDialog) * I ask for the number of tuples of table "table1" --> n tuples: * CRecordset crs (db1) * crs.Open (CRecordset::snapshot, "SELECT count (*) FROM table1;") * I make the "connexion1" serializable : * db1->ExecuteSQL ("BEGIN TRANSACTION;") * db1->ExecuteSQL ("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;") * In the connexion1, I add a tuple in the table "table1" : * db1->ExecuteSQL ("INSERT INTO table1 ..;") * In the connexion1, I ask for the number of tuples of table "table1" --> n+1 tuples * CRecordset crs (db1) * crs.Open (CRecordset::snapshot, "SELECT count (*) FROM table1;") * In the connexion2, I ask for the number of tuples of table "table1" --> n+1 tuples; * CRecordset crs (db1) * crs.Open (CRecordset::snapshot, "SELECT count (*) FROM table2;") I don't understand why the number is not n tuples in the "connexion2" because the connexion1 is serializable ? Do I use the good parameters for ODBC? Are there some restrictions for the use of the cursors with ODBC-PostgreSQL and the transaction isolation level ? My parameters are the followings: "DRIVER={PostgreSQL ANSI};DATABASE=;SERVER=;PORT=5438;UID=;PWD=;SSLmode=disable;ReadOnly=0;Protocol=7.4-1;FakeOidIndex=0;ShowOidColumn=0; RowVersioning=0;ShowSystemTables=0;ConnSettings=;Fetch=10000;Socket=4096;Unk nownSizes=0;MaxVarcharSize=255;MaxLongVarcharSize=5400000;Debug=0;CommLog=0; Optimizer=1;Ksqo=1;UseDeclareFetch=1;TextAsLongVarchar=1;UnknownsAsLongVarch ar=1;BoolsAsChar=1;Parse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;;LFC onversion=0;UpdatableCursors=1;DisallowPremature=0;TrueIsMinus1=0;BI=0;Bytea AsLongVarBinary=0;UseServerSidePrepare=1;LowerCaseIdentifier=0;XaOpt=1" If I use the option "UseDeclareFetch=0", the transaction isolation level serializable is respected. Thank's all Olivier ------=_NextPart_000_010A_01C9B3BB.FB293D90 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hello,

 

I have some problems to have a transaction = isolation level serializable with postgresql-ODBC driver for windows by using the = ODBC cursor (UseDeclareFetch=3D1).

 

My database is on PostgreSQL 8.3.7/ = Linux.

I use the postgresql-ODBC version = 8.03.04 for windows.

I make this test with the = default_transaction_isolation =3D 'read committed' and after with the default_transaction_isolation = =3D 'serializable' on the server. The results are the same.

 

I do the followings operations in a c++ = programm:

  • I open 2 connections on my database with the ODBC drivers: = “connexion1” and “connexion2”
    • CDatabase * db1 =3D new CDatabase ;
    • CDatabase * db2 =3D new = CDatabase
    • db1->OpenEx (chaine_connection_mydatabase, CDatabase::noOdbcDialog);
    • db2->OpenEx (chaine_connection_mydatabase, = CDatabase::noOdbcDialog)
  • I ask = for the number of tuples of table “table1” à n tuples:
    • CRecordset crs (db1)
    • crs.Open (CRecordset::snapshot, "SELECT = count (*) FROM table1;")
  • I make = the “connexion1” serializable :
    • db1->ExecuteSQL (“BEGIN = TRANSACTION;”)
    • db1->ExecuteSQL (“SET TRANSACTION = ISOLATION LEVEL SERIALIZABLE;”)
  • In the = connexion1, I add a tuple in the table “table1” = :
    • db1->ExecuteSQL ("INSERT INTO table1 ….;”)
  • In the = connexion1, I ask for the number of tuples of table “table1” = à n+1 = tuples
    • CRecordset crs (db1)
    • crs.Open (CRecordset::snapshot, "SELECT = count (*) FROM table1;")
  • In the = connexion2, I ask for the number of tuples of table “table1” = à n+1 = tuples;
    • CRecordset crs (db1)
    • crs.Open (CRecordset::snapshot, "SELECT = count (*) FROM table2;")

I don’t understand why the number is = not n tuples in the “connexion2” because the connexion1 is = serializable ?

 

Do I use the good parameters for ODBC? Are = there some restrictions for the use of the cursors with ODBC-PostgreSQL and = the transaction isolation level ?

My parameters are the = followings:

“DRIVER=3D{PostgreSQL = ANSI};DATABASE=3D<mabase>;SERVER=3D<monserver>;PORT=3D5438;UI= D=3D<user>;PWD=3D<password>;SSLmode=3Ddisable;ReadOnly=3D0;Pr= otocol=3D7.4-1;FakeOidIndex=3D0;ShowOidColumn=3D0;RowVersioning=3D0;ShowS= ystemTables=3D0;ConnSettings=3D;Fetch=3D10000;Socket=3D4096;UnknownSizes=3D= 0;MaxVarcharSize=3D255;MaxLongVarcharSize=3D5400000;Debug=3D0;CommLog=3D0= ;Optimizer=3D1;Ksqo=3D1;UseDeclareFetch=3D1;TextAsLongVarchar=3D1;Unknown= sAsLongVarchar=3D1;BoolsAsChar=3D1;Parse=3D0;CancelAsFreeStmt=3D0;ExtraSy= sTablePrefixes=3Ddd_;;LFConversion=3D0;UpdatableCursors=3D1;DisallowPrema= ture=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongVarBinary=3D0;UseServerSidePr= epare=3D1;LowerCaseIdentifier=3D0;XaOpt=3D1”

 

If I use the option = “UseDeclareFetch=3D0”, the transaction isolation level serializable is = respected.

 

Thank’s = all

 

Olivier

 

 

 

------=_NextPart_000_010A_01C9B3BB.FB293D90--