Fwd: Bug #32774: stdin handling confusion in COPY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



From: PHP Bug Database <php-bugs@xxxxxxxxxxxxx>
Date: Apr 20, 2005 1:13 AM
Subject: Bug #32774: stdin handling confusion in COPY
To: volkan.yazici@xxxxxxxxx


From:             volkan dot yazici at gmail dot com
Operating system: Linux 2.6.11
PHP version:      5.0.3
PHP Bug Type:     PostgreSQL related
Bug description:  stdin handling confusion in COPY

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.


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux