#32774 [Opn->Fbk]: stdin handling confusion in COPY
| From: | sniper@php.net | Date: | Sun, 26 Jun 2005 17:18:18 +0000 |
| Subject: | #32774 [Opn->Fbk]: stdin handling confusion in COPY | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81039@lists.php.net to get a copy of this message | ||
ID: 32774
Updated by: sniper@php.net
Reported By: volkan dot yazici at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: PostgreSQL related
Operating System: Linux 2.6.11
PHP Version: 5.0.3
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-04-20 00:13:07] volkan dot yazici at gmail dot com
Description:
------------
There seems to be a confusion in handling stdin between PostgreSQL and
PHP.
Reproduce code:
---------------
<?php
$conn = pg_connect("user=knt dbname=template1")
or die("Connection failed!\n");
print "Starting query...\n";
$res = pg_query("COPY example_table FROM stdin");
/*
* If I'd not use a pg_end_copy() call just after "COPY FROM
* stdin" query, script flow will never pass through this
* line and stuck here with a 100% CPU usage.
*/
if ( pg_result_status($res) != PGSQL_COPY_IN )
die("Unexpected result status!\n");
print "At last!\n";
pg_close();
?>
/*
* The same of this script
* [http://yazicivo.fateback.com/example-copy.txt] written
* in C (with same libpq calls) works fine.
*/
Expected result:
----------------
shell$ php example-copy.php
Starting query...
At last!
shell$ _
Actual result:
--------------
shell$ php example-copy.php
Starting query...
# It enters to an endless loop with a 100% CPU usage.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32774&edit=1