|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-10-25 20:58 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 01:00:01 2025 UTC |
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: ''This won't block: <?php for($i=1;$i<=10;$i++) { echo "Interation $i\n"; $dbconn[$i] = pg_connect("dbname=postgres", PGSQL_CONNECT_FORCE_NEW); // Will block in the second loop interation pg_send_query($dbconn[$i], "select pg_sleep(5)"); echo "Last error: '".pg_last_error($dbconn[$i])."'\n"; } ?> So the issue only happens when you "overwrite" an existing connection