Re: 08P01: unexpected EOF on client connection - Mailing list pgsql-general

From Jasen Betts
Subject Re: 08P01: unexpected EOF on client connection
Date
Msg-id gthfei$p86$1@reversiblemaps.ath.cx
Whole thread Raw
In response to 08P01: unexpected EOF on client connection  (Tomas Vondra <tv@fuzzy.cz>)
List pgsql-general
On 2009-05-01, Tomas Vondra <tv@fuzzy.cz> wrote:
> Hi,
>
> I've run into some strange troubles with a quite simple web application
> that stores data in a PostgreSQL database. It is a simple image gallery,
> displaying multiple thumbnails (stored in a bytea column) on a single
> page generated by PHP. The problem is some of the images are not displayed.
>
> $conn = pg_connect(...);
> $res = pg_query("SELECT mime, thumbnail_data FROM images WHERE filename
>= ....");
> $row = pg_fetch_assoc($row);
> header('Content-Type: ' . $row['mime']);
> echo pg_unescape_bytea($row['thumbnail_data']);

This is cut-n-paste from a working site (pg 7.4, PHP 4.3.9)

 $res=pg_query("select * from images where id='$id' ;");
 $row=pg_fetch_assoc($res);
 header("content-type: $row[type]");
 echo pg_unescape_bytea($row['data']);

the date on the file is NOV 19 2006.
wasn't I a crap programmer back then :)



pgsql-general by date:

Previous
From: Thomas Pundt
Date:
Subject: Re: How to begin to debug FATAL: invalid frontend message type 77 error messages?
Next
From: Thomas Kellerer
Date:
Subject: Re: Possible to prevent transaction abort?