php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56411 Cursor declaration wrong
Submitted: 2005-06-07 15:16 UTC Modified: 2005-07-02 23:04 UTC
From: php at sharpdreams dot com Assigned: wez (profile)
Status: Closed Package: PDO_PGSQL (PECL)
PHP Version: 5_1 CVS-2005-06-07 (dev) OS: Win32 (XP)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 + 21 = ?
Subscribe to this entry?

 
 [2005-06-07 15:16 UTC] php at sharpdreams dot com
Description:
------------
I am fairly certain the PDO_PGSQL driver is wrong in the cursor definition. My queries are coming in to Postgres as:

DECLARE pdo_pgsql_cursor_0cee9018 FOR select thi_id, ...

whereas Postgres is expecting:

DECLARE pdo_pgsql_cursor_0cee9018 CURSOR FOR select thi_id, ...

Also, Postgres cursors *Require* transactions. Should this be enabled automatically when a cursor is processed?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-10 02:15 UTC] wez@php.net
Is there an actual error message coming back, or is this just a hunch?

As for transactions, you should create one explicitly, as you can do a better job of figuring out where you need to start one in your code.
 [2005-06-10 16:12 UTC] php at sharpdreams dot com
Yes, there was an actual error message (exception) and in my pgsql logs I see (I put reporting on 'all'):

LOG BEGIN
LOG statement DECLARE pdo_pgsql_cursor_04fc8f10 FOR select * from stemplates
ERROR syntax at or near "FOR" at character 35
LOG CLOSE pdo_pgsql_cursor_04fc8f10
ERROR current transaction is aborted, commands ignored until end of transaction block

However, if I issue a manual cursor query as "DECLARE test_cursor CURSOR FOR select * from stemplates;" it works fine. Omitting "CURSOR" causes the same error as PDO_PGSQL does.

Also, attempting to set PDO_ATTR_CURSOR_NAME => "testcursor" in the prepare() statement doesn't seem to do anything with PDO_PGSQL.
 [2005-07-02 23:04 UTC] wez@php.net
Fixed in CVS.  Please try the next PHP 5.1 snapshot dated after this message.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC