Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYayb-0001dT-IJ for pgsql-odbc@arkaria.postgresql.org; Fri, 11 Apr 2014 12:54:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WYayb-0005nr-0U for pgsql-odbc@arkaria.postgresql.org; Fri, 11 Apr 2014 12:54:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYaOF-000314-CH for pgsql-odbc@postgresql.org; Fri, 11 Apr 2014 12:17:03 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYaOA-0001pK-LF for pgsql-odbc@postgresql.org; Fri, 11 Apr 2014 12:17:01 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 0A15628B13 for ; Fri, 11 Apr 2014 05:16:54 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 0385B18B9B for ; Fri, 11 Apr 2014 05:16:54 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 1A0E2C0061 for ; Fri, 11 Apr 2014 05:16:47 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA for ; Fri, 11 Apr 2014 05:16:46 -0700 (PDT) Message-ID: <5347DD33.4040001@vmware.com> Date: Fri, 11 Apr 2014 15:16:51 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: "pgsql-odbc@postgresql.org" Subject: UseDeclareFetch bugs, found & fixed Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.3 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org Hi all, If you run the pgsql-odbc regression suite with UseDeclareFetch=1, you get two failures: 1. notice > *** psqlodbc/test/expected/notice.out 2014-03-24 08:45:07.567976184 +0200 > --- psqlodbc/test/results/notice.out 2014-04-11 15:00:01.250084814 +0300 > *************** > *** 1,7 **** > \! ./src/notice-test > connected > - got SUCCESS_WITH_INFO > - 00000=NOTICE: test notice: foo > - got SUCCESS_WITH_INFO > - 00000= > disconnecting > --- 1,3 ---- In a nutshell, with UseDeclareFetch=1, NOTICE messages are lost. The server sends them to the client with the response to the DECLARE CURSOR statement, but the driver throws away the response to DECLARE CURSOR. It waits for the response to the FETCH statement, and returns that instead. To fix, before throwing away the response, copy any NOTICE messages from the Qresult for the DECLARE CURSOR forward to the next Qresult. 2. dataatexecution > *** /home/heikki/git-sandbox-pgsql/psqlodbc/test/expected/dataatexecution.out 2014-03-24 08:45:07.567976184 +0200 > --- /home/heikki/git-sandbox-pgsql/psqlodbc/test/results/dataatexecution.out 2014-04-11 15:00:05.934040285 +0300 > *************** > *** 3,12 **** > Result set: > 2 > 3 > ! Parameter Status > ! Fetching result sets for array bound (2 results expected) > ! 1: Result set: > ! 4 > ! 2: Result set: > ! 5 > ! disconnecting > --- 3,8 ---- > Result set: > 2 > 3 > ! SQLParamData failed > ! 42P03=ERROR: cursor "SQL_CUR0xe20060" already exists; > ! Error while executing the query Even though it's the dataatexecution regression test that fails, this isn't related to data-at-execution, but array-binding of parameters. With array-bound parameters, the driver will execute the same statement multiple times, once for each set of parameters. If the statement is a SELECT-query, it will try to execute the "DECLARE CURSOR" many times, without closing the cursor inbetween, which fails. To fix, I just disabled using cursors with array-bound parameters. I'm not sure if there would be a better fix - like close the cursor between the calls - but this is good enough for me. I pushed a fix for those. - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc