pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: UseDeclareFetch bugs, found & fixed
Date: Fri, 11 Apr 2014 15:16:51 +0300
Message-ID: <5347DD33.4040001@vmware.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

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



Message-ID: <5347DD33.4040001@vmware.com>
Permalink:  ../5347DD33.4040001@vmware.com/
Also on:    postgresql.org/message-id/5347DD33.4040001@vmware.com

 · 

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: hlinnakangas@vmware.com
  Subject: Re: UseDeclareFetch bugs, found & fixed
  In-Reply-To: <5347DD33.4040001@vmware.com>
  References: <5347DD33.4040001@vmware.com>

* 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