Bug #655: win32 client and bytea column

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #655: win32 client and bytea column
Date: 2002-05-02 16:53:45
Message-ID: 20020502165345.E7A69476BF6@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Krzysztof Stachlewski (stach(at)toya(dot)net(dot)pl) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
win32 client and bytea column

Long Description
I have a problem with using bytea column with PHP.
I am using Apache 1.3.24 on Windows 2000, PHP 4.2.0
installed as Apache module.
PostgreSQL 7.2.1 on Linux (Debian).
When trying to manipulate the bytea column I get the following error:
pg_exec() query failed: pqReadData() -- read() failed: errno=0 No error
The guys from PHP told me this is not a problem with their code, but
with postgresql. (I submitted a bug report to php.net)
The error message is shown only when the code is runned from PHP on
Windows system. Exactly the same code, runned on Linux version
of PHP 4.1.2 causes no
problems at all. The problem does not appear when the amount of
data in the bytea column or data to be inserted into bytea
column is small enough.
"Small enough" seems to be sth about few hundred bytes.
I thought this is a problem with the libpq.dll - the version of
the one that shipped with PHP was 7.0.2.
I have downloaded the latest source code of Postgres and compiled
the 7.2.1 version of the dll. That didn't solve the problem.

Sample Code
create table bin(id int primary key, dat bytea not null);

php code below:
<?
$connection = pg_connect("your favourite connection string");
$data = base64_encode(str_repeat("example", 1000));
$query = "insert into bin values (1, decode('$data', 'base64'))");
pg_exec($connection, $query)
?>

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-05-03 05:24:26 Bug #656: timestamp function generates parsing errors when used as specified in the documentation
Previous Message Tatsuo Ishii 2002-05-02 10:01:40 Re: Bug #654: lower and to_ascii don't work with UTF8