From: Volkan YAZICI <volkan.yazici@gmail.com>
To: pgsql-php@postgresql.org
Subject: Fwd: Bug #32774: stdin handling confusion in COPY
Date: Sun, 1 May 2005 17:12:04 +0300
Message-ID: <7104a7370505010712245903b5@mail.gmail.com> (raw)
In-Reply-To: <bug-32774@bugs.php.net>
References: <bug-32774@bugs.php.net>
From: PHP Bug Database <php-bugs@lists.php.net>
Date: Apr 20, 2005 1:13 AM
Subject: Bug #32774: stdin handling confusion in COPY
To: volkan.yazici@gmail.com
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: volkan.yazici@gmail.com
Subject: Re: Fwd: Bug #32774: stdin handling confusion in COPY
In-Reply-To: <7104a7370505010712245903b5@mail.gmail.com>
References: <bug-32774@bugs.php.net> <7104a7370505010712245903b5@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox