Perl 5 Interface on 6.5 and lo_creat/lo_open problem - Mailing list pgsql-hackers

From Kristofer Munn
Subject Perl 5 Interface on 6.5 and lo_creat/lo_open problem
Date
Msg-id Pine.LNX.4.04.9906231753260.4302-100000@dec.munn.com
Whole thread Raw
Responses Re: [HACKERS] Perl 5 Interface on 6.5 and lo_creat/lo_open problem
List pgsql-hackers
Is anyone else having any problems with the Perl Interface wrt Large
Objects under 6.5?

I compiled and installed 6.5 on an Intel/Linux/RedHat 6.0 machine that had
previously had 6.4.2 and imported existing data from the old database.  
Perl scripts which were working under the previous version are now failing
when trying to open a newly created large object.  A line appears in the
error log:

Jun 23 17:40:47 www logger: ERROR:  lo_lseek: invalid large obj descriptor (0)

While the code being executed is a function call write_blob below. The
scaffolding internally tells me it is unable to open oid XXXXXX for
writing where XXXXXX is the newly "created" oid #.

sub write_blob {   my($oid, $blob) = @_;
   print "write_blob($oid, '$blob');\n" if $debug;   if ($blob eq "") {       if ($oid > 0) {
$conn->lo_unlink($oid);      }       print "No blob to write\n" if $debug;       return "NULL";   }   if ($oid == 0) {
    $oid = $conn->lo_creat(PGRES_INV_WRITE | PGRES_INV_READ);       if ($oid == PGRES_InvalidOid) {           print
"Unableto get new oid.\n" if $debug;           return "NULL";       }   }   my($lobj_fd) = $conn->lo_open($oid,
PGRES_INV_WRITE);  if ($lobj_fd == -1) {       print "Unable to open oid $oid for writing.\n" if $debug;       return
"NULL";  }
 
   if ($conn->lo_write($lobj_fd, $blob, length($blob)) == -1) {       $conn->lo_close($lobj_fd);
$conn->lo_unlink($oid);      print "Unable to write blob into open oid $oid.\n" if $debug;       return "NULL";   }
$conn->lo_close($lobj_fd);
   print "write_blob successful\n" if $debug;
   return $oid;
}

I reverted to 6.4.2 and the scripts worked again.  Back to 6.5 - no dice.

- K

Kristofer Munn * http://www.munn.com/~kmunn/ * ICQ# 352499 * AIM: KrMunn 




pgsql-hackers by date:

Previous
From: "D'Arcy" "J.M." Cain
Date:
Subject: Re: [HACKERS] money data type and conversions]
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] money data type and conversions]