pg_transaction_status() unreliable?!

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: pg_transaction_status() unreliable?!
Date: 2009-05-01 21:03:02
Message-ID: 20090501170302.2eb5eb84.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php


I'm having some ugly fun here. It doesn't seem as if
pg_transaction_status() is reliable in the least.

For example, I'm doing the equivalent of the following:

pg_send_query_params($conn, 'BEGIN', array());
pg_get_result($conn);
... some other queries, each using pg_send_query_params() and
pg_get_result() ...
pg_send_query_params($conn, 'COMMIT', array());
pg_get_result($conn);
echo pg_transaction_status($conn);

Now, amazingly enough, pg_transaction_status() returns
PGSQL_TRANSACTION_ACTIVE after the commit. This makes no sense to
me at all ... it should return PGSQL_TRANSACTION_IDLE, since the
connection is no longer in a transaction.

Is anyone else seeing this? I have assertions failing all over the
place because my code thinks that transactions have been left
uncommitted.

Postgresql 8.3.5, FreeBSD 6.3, PHP 5.2.9 with Suhosin patch

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

Responses

Browse pgsql-php by date

  From Date Subject
Next Message ljb 2009-05-03 01:59:54 Re: pg_transaction_status() unreliable?!
Previous Message Andrew McMillan 2009-04-27 20:19:47 Re: Newbie Question-Quoting SQL