From:             levi at alliancesoftware dot com dot au
Operating system: FC3
PHP version:      5.1.2
PHP Bug Type:     PostgreSQL related
Bug description:  pg_get_result does not block

Description:
------------
According to the pg_connection_busy documentation, if pg_get_result is
called on a pg_send_query that is currently executing, it should block
until results become available.

Occasionally this does not happen if the query had an error in it.

Reproduce code:
---------------
#!/usr/local/bin/php51
<?php
  $connStr = sprintf("host=%s dbname=%s user=%s password=%s", 'localhost',
'testdb', 'liam', 'liam');
  $dbconn = pg_connect($connStr) or die("Could not connect");

        $i = 0;

        while (!pg_connection_busy($dbconn)) {
                pg_send_query($dbconn, 'i am a syntax error');
                pg_get_result($dbconn);
                $i++;
        }

        echo "got a busy signal after $i commands";

?>


Expected result:
----------------
(Loops forever)

Actual result:
--------------
got a busy signal after 221 commands

(actual count varies, but always returns within 1 second. Approximately
1/3 of the time it gives a "happy" run and will loop forever)


Note that if the SQL statement was a valid statement, I cannot get the
erroneous behaviour to occur.

-- 
Edit bug report at http://bugs.php.net/?id=36469&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36469&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36469&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36469&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36469&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36469&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36469&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36469&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36469&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36469&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36469&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36469&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36469&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36469&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36469&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36469&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36469&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36469&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36469&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36469&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36469&r=mysqlcfg

Reply via email to