ID: 23786
Updated by: [EMAIL PROTECTED]
Reported By: dave at codewhore dot org
-Status: Assigned
+Status: Open
Bug Type: Documentation problem
Operating System: Linux 2.4
PHP Version: 4CVS-2003-05-23 (stable)
Previous Comments:
------------------------------------------------------------------------
[2003-05-24 00:54:12] dave at codewhore dot org
I'm moving this to the documentation category, since I haven't been
able to prove that the invalidation of open large object handles is
actually a ext/pgsql problem (and not just intrinsic to the Postgres
server/protocol/client-library).
------------------------------------------------------------------------
[2003-05-23 15:55:02] dave at codewhore dot org
Hi:
Use of the pg_put_line() function causes most large object operations,
including pg_lo_read and pg_lo_tell, to subsequently fail. A test
script demonstrates this:
<?php
$c = pg_connect('dbname=database user=postgres');
var_dump($c);
var_dump(pg_query($c, 'begin transaction'));
$fd = pg_lo_open($c, $lo_id_goes_here, 'r');
var_dump($fd);
var_dump(pg_query($c, 'copy table_name_goes_here from stdin'));
var_dump(pg_put_line($c, "\\.\n"));
var_dump(pg_end_copy($c));
var_dump(pg_lo_tell($fd));
var_dump(pg_lo_close($fd));
var_dump(pg_query($c, 'commit'));
?>
I would expect to see:
resource(4) of type (pgsql link)
resource(5) of type (pgsql result)
resource(6) of type (pgsql large object)
resource(7) of type (pgsql result)
bool(true)
bool(true)
int(0)
bool(true)
Instead, I get:
resource(4) of type (pgsql link)
resource(5) of type (pgsql result)
resource(6) of type (pgsql large object)
resource(7) of type (pgsql result)
bool(true)
bool(true)
int(-1)
Warning: pg_lo_close(): Unable to close PostgreSQL large object
descriptor 0. in /home/dave/test.php on line 14
bool(false)
The pg_copy_from and pg_copy_to functions, strangely enough, don't
exhibit this behavior.
If this is something intrinsic to the design of Postgres' wire protocol
(e.g. not a PHP bug - I don't know if it is or not), it'd be worth
leaving a nice big warning in the docs for pg_put_line/pg_lo_open.
Thanks in advance,
- Dave
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23786&edit=1