From:             php at codewhore dot org
Operating system: Linux 2.4
PHP version:      4.3.0
PHP Bug Type:     PostgreSQL related
Bug description:  pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds yet always returns false

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)

-- 
Edit bug report at http://bugs.php.net/?id=22306&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22306&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22306&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22306&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22306&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22306&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22306&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22306&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22306&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22306&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22306&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22306&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22306&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22306&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22306&r=gnused

Reply via email to