Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Uev2U-0004Gd-7M for pgsql-odbc@arkaria.postgresql.org; Tue, 21 May 2013 22:28:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Uev2T-00061v-OF for pgsql-odbc@arkaria.postgresql.org; Tue, 21 May 2013 22:28:13 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Uev2S-00061p-TS for pgsql-odbc@postgresql.org; Tue, 21 May 2013 22:28:13 +0000 Received: from wsip-72-214-29-243.sd.sd.cox.net ([72.214.29.243] helo=joeconway.com) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Uev2M-0006MH-Qd for pgsql-odbc@postgresql.org; Tue, 21 May 2013 22:28:12 +0000 Received: from [192.168.4.41] (account jconway [192.168.4.41] verified) by joeconway.com (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 13062430 for pgsql-odbc@postgresql.org; Tue, 21 May 2013 15:30:17 -0700 Message-ID: <519BF4F6.9020200@joeconway.com> Date: Tue, 21 May 2013 15:28:06 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: "pgsql-odbc@postgresql.org" Subject: ODBC does not handle WITH clause X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 1.8 (+) 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 -----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----- -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc