Edit report at https://bugs.php.net/bug.php?id=63365&edit=1
ID: 63365
User updated by: chris at ctgameinfo dot com
Reported by: chris at ctgameinfo dot com
Summary: pg_send_query() blocks on queries to other
connections.
-Status: Feedback
+Status: Open
Type: Bug
Package: PostgreSQL related
Operating System: FreeBSD (probably irrevelant)
PHP Version: 5.4.8
Block user comment: N
Private report: N
New Comment:
Modified test script with requested pg_last_error output.
-------
<?php
for($i=1;$i<=10;$i++)
{
echo "Interation $i\n";
$dbconn = pg_connect("user=cstdenis dbname=postgres",
PGSQL_CONNECT_FORCE_NEW);
// Will block in the second loop interation
pg_send_query($dbconn, "select pg_sleep(5);");
echo "Last error: '".pg_last_error($dbconn)."'\n";
}
?>
Output:
-------
Interation 1
Last error: ''
Interation 2
Last error: ''
Interation 3
Last error: ''
Interation 4
Last error: ''
Interation 5
Last error: ''
Interation 6
Last error: ''
Interation 7
Last error: ''
Interation 8
Last error: ''
Interation 9
Last error: ''
Interation 10
Last error: ''
Previous Comments:
------------------------------------------------------------------------
[2012-10-28 13:57:36] [email protected]
Please, check out the return from pg_last_error($dbconn); after the
pg_send_query() call and post the result in there.
------------------------------------------------------------------------
[2012-10-25 20:58:13] chris at ctgameinfo dot com
Description:
------------
If I open a connection and send a long running query with pg_send_query, then
open a second connection and try to send a query over the second connection
with
pg_send_query it will block on the first connection's query not being complete
Test script:
---------------
<?php
for($i=1;$i<=10;$i++)
{
echo "Interation $i\n";
$dbconn = pg_connect("user=pgsql dbname=postgres",
PGSQL_CONNECT_FORCE_NEW);
// Will block in the second loop interation
pg_send_query($dbconn, "select pg_sleep(5);");
}
?>
Expected result:
----------------
pg_send_query should only block on incomplete queries on the same connection.
Actual result:
--------------
pg_send_query blocks on incomplete queries on any connection.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63365&edit=1