(PHP 5 >= 5.1.0, PHP 7)
pg_transaction_status — Devuelve el estado actual de la transaccion del servidor
$connection
   ) : intDevuelve el estado actual de la transacción del servidor.
pg_transaction_status() Dará resultados incorrectos al usar un servidor PostgreSQL 7.3 que tenga el parámetro autocommit establecido en off. La función de autocommit del lado del servidor esta obsoleta y no existe en las versiones posteriores del servidor.
connectionRecurso de conexión a la base de datos PostgreSQL.
The status can be PGSQL_TRANSACTION_IDLE (currently idle),
    PGSQL_TRANSACTION_ACTIVE (a command is in progress),
    PGSQL_TRANSACTION_INTRANS (idle, in a valid transaction block),
    or PGSQL_TRANSACTION_INERROR (idle, in a failed transaction block).
    PGSQL_TRANSACTION_UNKNOWN is reported if the connection is bad.
    PGSQL_TRANSACTION_ACTIVE is reported only when a query
    has been sent to the server and not yet completed.
  
Ejemplo #1 Ejemplo de pg_transaction_status()
<?php
  $dbconn = pg_connect("dbname=publisher") or die("Could not connect");
  $stat = pg_transaction_status($dbconn);
  if ($stat === PGSQL_TRANSACTION_UNKNOWN) {
      echo 'Connection is bad';
  } else if ($stat === PGSQL_TRANSACTION_IDLE) {
      echo 'Connection is currently idle';
  } else {
      echo 'Connection is in a transaction state';
  }    
?>