RedHat 6.1, Postgresql 6.5.2 (tried on 6.5.3 - same result).

------------------------------- Code:

#include <stdio.h>
#include <pgsql/libpq-fe.h>
#include <pgsql/libpq/libpq-fs.h>

int main() {
  PGconn *conn;
  PGresult *res;
  conn = PQsetdb(NULL, NULL, NULL, NULL, "ctlg");
  if(PQstatus(conn) == CONNECTION_BAD) {
    printf("Cannot connect\n");
    exit(1);
  }
  Oid LOid;
  LOid = lo_creat(conn, INV_READ | INV_WRITE);
  if(LOid == 0) {
    printf("Cannot create\n");
    exit(1);
  }
  printf("Created with Oid=%d\n", LOid);
  int LOfd;
  LOfd = lo_open(conn, LOid, INV_READ | INV_WRITE);
  printf("Opened with LOfd = %d, %s\n", LOfd, PQerrorMessage(conn));
}

----------------------------------- Result:

Created with Oid=31169
Opened with LOfd = -1, ERROR:  lo_lseek: invalid large obj descriptor
(0)

----------------------------------- Debug:

FindExec: found "/usr/bin/postgres" using argv[0]
/usr/bin/postmaster: BackendStartup: pid 1012 user root db ctlg socket 4

FindExec: found "/usr/bin/postgres" using argv[0]
started: host=localhost user=root database=ctlg
InitPostgres
StartTransactionCommand
ProcessQuery
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
ERROR:  lo_lseek: invalid large obj descriptor (0)
AbortCurrentTransaction
pq_recvbuf: unexpected EOF on client connection
proc_exit(0) [#0]
shmem_exit(0) [#0]
exit(0)
/usr/bin/postmaster: reaping dead processes...
/usr/bin/postmaster: CleanupProc: pid 1012 exited with status 0
pmdie 2
proc_exit(0) [#0]
shmem_exit(0) [#0]
exit(0)

------------------------------------------


Fri, 18 Feb 2000 11:20:48 +0300
root <victor_moroz@public.mtu.ru>
Large object problem in 6.5.2 & 3