|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-05-24 00:54 UTC] dave at codewhore dot org
[2004-09-22 11:02 UTC] vrana@php.net
[2004-09-22 11:05 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 19:00:01 2025 UTC |
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