lobj bug - Mailing list pgsql-bugs

From Cob
Subject lobj bug
Date
Msg-id 87emey1gk6.fsf@rock.gnt.kiev.ua
Whole thread Raw
List pgsql-bugs
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Alexey Kobozev
Your email address      : cob@gnt.kiev.ua


System Configuration
---------------------
  Architecture (example: Intel Pentium)         : Intel Pentium

  Operating System (example: Linux 2.0.26 ELF)  : FreeBSD 2.2.1 & Solaris 2.6

  PostgreSQL version (example: PostgreSQL-6.5.2): PostgreSQL-6.5 & 6.5.2

  Compiler used (example:  gcc 2.8.0)           : gcc version 2.7.2.1 & 2.8.1


Please enter a FULL description of your problem:
------------------------------------------------
Bug in libpq (IMHO).

When I've got large object id (oid) from table any attempt to
open it with lo_open (lo_export) returns -1 (perrno = 2 - not found).

But using of built-in lo_import/lo_export
(insert into xxx values(lo_import('file')) or select lo_export(lobj_id))
successful.


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

create table tmp (lobj oid);

insert into tmp values(lo_import('some_file'));

select lobj from tmp;
lobj
------
xxxxxx

//------------- problem.c ----------------

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

void main()
{
  PGconn *dbConn = PQsetdb(NULL, NULL, NULL, NULL, "database");
  if(PQstatus(dbConn) == CONNECTION_BAD)
  {
    fprintf(stderr, "%s\n", PQerrorMessage(dbConn));
    exit(1);
  }

  if(lo_export(dbConn, xxxxxx, "/tmp/lobj") < 0)
    fprintf(stderr, "Can't export lobj\n"); //we'll get here

  if(lo_open(dbConn, xxxxxx, INV_READ) < 0)
    fprintf(stderr, "Can't even open lobj\n"); //we'll get here

  PQfinish(dbConn);
}

//--------------------------------------------


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------











pgsql-bugs by date:

Previous
From: Peter Schaefer
Date:
Subject: Re: [BUGS] CREATE VIEW interp AS select DISTINCT itemkey from songs;
Next
From: Peter Schaefer
Date:
Subject: default operator (int8le?)