|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-19 16:07 UTC] php at codewhore dot org
Seeking back to the beginning of a file on a PostgreSQL large object handle returns false, even though the seek succeeds.
The following script:
<?php
$database = pg_connect ('dbname=pile_dev user=postgres');
pg_exec ($database, 'begin transaction');
$oid = pg_lo_create($database);
$handle = pg_lo_open($database, $oid, "rw");
echo 'write: ';
var_dump(pg_lo_write($handle, 'foo'));
echo 'tell: ';
var_dump(pg_lo_tell($handle));
echo 'seek to begin: ';
var_dump(pg_lo_seek($handle, 0, PGSQL_SEEK_SET));
echo 'tell: ';
var_dump(pg_lo_tell($handle));
pg_exec($database, 'commit');
pg_close($database);
?>
outputs:
write: int(3)
tell: int(3)
seek to begin: bool(false)
tell: int(0)
I expected:
write: int(3)
tell: int(3)
seek to begin: bool(true)
tell: int(0)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 09:00:02 2025 UTC |
From ext/pgsql/pgsql.c: if (lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence )) { RETURN_TRUE; } else { RETURN_FALSE; } If lo_lseek() is anything like the POSIX lseek(), shouldn't the above return false when the return value is -1, not zero?