#37870 [Opn->Asn]: Deallocation of prepared statement that hasn't been allocated under postgresql
| From: | tony2001@php.net | Date: | Thu, 22 Jun 2006 19:04:49 +0000 |
| Subject: | #37870 [Opn->Asn]: Deallocation of prepared statement that hasn't been allocated under postgresql | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-98680@lists.php.net to get a copy of this message | ||
ID: 37870
Updated by: tony2001@php.net
Reported By: sagi at adamnet dot co dot il
-Status: Open
+Status: Assigned
Bug Type: PDO related
Operating System: Debian Sarge
PHP Version: 5.1.4
-Assigned To:
+Assigned To: wez
Previous Comments:
------------------------------------------------------------------------
[2006-06-21 07:52:22] sagi at adamnet dot co dot il
Description:
------------
Using PHP 5.1.4 to connect to a postgresql 8.1.4 database, native
prepared statements.
When allocating a prepared statement and then trying to unset it, PDO
attemps to deallocate it even if it never been used (eg. when running a
query against an empty set).
PDO does not throw an exception in such case, but an error such as:
ERROR: prepared statement "pdo_pgsql_stmt_085b2f2c" does not exist
Appers in the server log.
When running inside a transaction, such error aborts it.
Reproduce code:
---------------
$pdo->beginTransaction();
$stmt = $pdo->prepare("SELECT 'never executed'");
unset($stmt);
$res = $pdo->query('SELECT 123');
Actual result:
--------------
PHP Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current
transaction is aborted, commands ignored until end of transaction
block' in XXX:13
Stack trace:
#0 XXX: PDO->query('SELECT 123')
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37870&edit=1