Sorry for the late reply - but I still haven't found a solution,
for example I have a PHP script with 5 consecutive SELECT
statements (source code + problem described again under:
http://stackoverflow.com/questions/6458246/php-and-pgbouncer-in-transaction-mode-current-transaction-is-aborted
) and if I add $db->beginTransaction(); $db->commit();
around each $db->prepare("select ..."); execute();
then my script will fail very often with
SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current
transaction is aborted, commands ignored until end of transaction
block
But if I omit $db->beginTransaction(); $db->commit();
completely, then it will fail less often, but still fail with:
SQLSTATE[26000]: Invalid sql statement name: 7 ERROR: prepared
statement "pdo_stmt_00000016" does not exist
My guess is that the 2nd behaviour is less frequent
because it occurs only when pgbouncer switches
connections exactly between prepare()/execute().
If I try PDO::ATTR_EMULATE_PREPARES => true
or pool_mode = session - my web site will hang.
Regards
Alex