ODBC does not handle WITH clause

From: Joe Conway <mail(at)joeconway(dot)com>
To: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: ODBC does not handle WITH clause
Date: 2013-05-21 22:28:06
Message-ID: 519BF4F6.9020200@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It seems the ODBC driver does not deal well with a WITH clause in a
statement:

8<----------------------------------
SQL> select id from generate_series(1,2) as t(id)
+------------+
| id |
+------------+
| 1 |
| 2 |
+------------+
SQLRowCount returns -1
2 rows fetched
SQL> select w.id from (select id from generate_series(1,2) as t(id)) as w
+------------+
| id |
+------------+
| 1 |
| 2 |
+------------+
SQLRowCount returns -1
2 rows fetched
SQL> with w as (select id from generate_series(1,2) as t(id)) select
w.id from w
SQLRowCount returns 0
SQL> select id from generate_series(1,2) as t(id)
[ISQL]ERROR: Could not SQLExecute
8<----------------------------------

The last statement fails (according to the logs) because:
ERROR: cursor "SQL_CUR0x17c4bd0" already exists

At that point the only recovery is ABORT.

8<----------------------------------
SQL> abort
SQLRowCount returns 0
SQL> select id from generate_series(1,2) as t(id)
+------------+
| id |
+------------+
| 1 |
| 2 |
+------------+
SQLRowCount returns -1
2 rows fetched
8<----------------------------------

This is with the latest odbc package on Linux Mint 14, but I have seen
it on a client machine based on current Red Hat as well. Is this a
known issue?

Thanks,

Joe

- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRm/T1AAoJEDfy90M199hl5ZgQAJ1IIyHggS5IGf+HqRqVizl1
GUqrPP0gK5SzMHWvPacVRZyGyZZogjy7zW6w69I6zlQtxZ++EZCzBe5uSCwVU+Bb
uQ7TsR/RBJoe0ftSDBiID52p3MJp/hbhhNJgi8Pky2GyntvEYuBe4YIFqAocfgts
MSVmU19zujpL1AKXsjUW9Viql+7bk9AT/Qz8RZARtLJ0XbwUuSHWiVphVzY5PuBt
DdjOZ8IzQken2WckvSkRkgkmeked18/3/TqzhApaWJAnOpak6Xl2n5ITre5lnnIa
IMQq6e2tu9UlKPrlNA9Y6gjirDgUqxas9uflqHfWrI0ks/uE8q6oIZ/ZPamnT8/e
kaoIVs6u5pt/zKcIRuKR05oOzdt/ZWzM+8cH+YlrcmNYROikoN4m2K96PHN/MgFb
FUJqAX0mFyrAKObNhN1giqWTpwVsSKkK82jVGGH2CfTNcdPdJlmMx3xvDUk5vMZe
Ocl0EGBV3rK7kdjn1/xcEASve0/WzS/LKVx4uKiqyBJ8we0xrcYXJ4IBZcu2BzC0
c+bqxJ+nDHDEU1dvPcwUZyh4s61OVKU0fbvgxTONizi90DMlf+cTkP4tnrjS5fai
DMxlojL7n6FzCt4oNNsufEqooG3dhcc3Mih0PKVltUhvIcA30LpDGPkl0R376fWV
9r1Et3Z2o/AIrD9LdQ48
=acL+
-----END PGP SIGNATURE-----

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Dev Kumkar 2013-05-21 22:49:14 Re: [ODBC] ODBC constructs
Previous Message John R Pierce 2013-05-21 22:17:36 Re: [ODBC] ODBC constructs