|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: php at sharpdreams dot com
New email:
PHP Version: OS:


 [2005-06-07 15:16 UTC] php at sharpdreams dot com
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?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-10 02:15 UTC]
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 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]
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 Jun 14 16:01:33 2024 UTC