pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Douglas Thomson <dougt@mugc.cc.monash.edu.au>
To: tgl@sss.pgh.pa.us
Cc: woho@ieee.org
Cc: pgsql-interfaces@hub.org
Subject: Re: [INTERFACES] problems with large-objects
Date: Sun, 3 Oct 1999 14:14:33 +1000 (EST)
Message-ID: <199910030414.OAA26402@mugca.cc.monash.edu.au> (raw)
In-Reply-To: <1665.938878406@sss.pgh.pa.us>

Tom Lane <tgl@sss.pgh.pa.us> writes:
> 6.5.* only allows large objects to be kept open within a single
> transaction; you have to wrap BEGIN...END around anything that involves
> lo_open ... lo_read/write ... lo_close.  In particular, since lo_import
> and lo_export are just such sequences, they need to be called inside
> a transaction.

Note that the Perl interface to large objects is broken in both 6.4.2
and 6.5.1, in that a BLOB containing a NUL character will be truncated
at the first NUL when read back using the Perl lo_read method. I have
reported this problem both to this list and via various other channels
over the past few months, but I just checked the CVS repository and
there is still no fix there.

For what it is worth, in case anyone reading this wants to either fix
their own copies or better yet fix the main source repository, the
necessary patch is simply:

======cut=here========================================================
inline patch 1: perl5.fixed/Pg.xs Sun Oct 3 14:00:35 1999 (+3/-3 lines) download inline-1.patch--- perl5/Pg.xs Sat Aug 14 12:46:35 1999 +++ perl5.fixed/Pg.xs Sun Oct 3 14:00:35 1999 @@ -1,6 +1,6 @@ /*------------------------------------------------------- * - * $Id: Pg.xs,v 1.12 1999/02/19 23:27:17 tgl Exp $ + * $Id: Pg.xs,v 1.12 1999/02/19 23:27:17 tgl Exp $ (NUL bug patched) * * Copyright (c) 1997, 1998 Edmund Mergl * @@ -643,7 +643,7 @@ } OUTPUT: RETVAL - buf + buf sv_setpvn((SV*)ST(2), buf, RETVAL); int lo_write(conn, fd, buf, len) @@ -1029,7 +1029,7 @@ } OUTPUT: RETVAL - buf + buf sv_setpvn((SV*)ST(2), buf, RETVAL); int ======cut=here========================================================
For the curious, this makes Perl set the length of the returned scalar to be the size returned by the library lo_read() call, instead of using C's strlen() function to work out the length. Hope this helps someone, Doug.

view thread (13+ messages)  latest in thread

Message-ID: <199910030414.OAA26402@mugca.cc.monash.edu.au>
Permalink:  ../199910030414.OAA26402@mugca.cc.monash.edu.au/
Also on:    postgresql.org/message-id/199910030414.OAA26402@mugca.cc.monash.edu.au

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: dougt@mugc.cc.monash.edu.au, tgl@sss.pgh.pa.us, woho@ieee.org, pgsql-interfaces@hub.org
  Subject: Re: [INTERFACES] problems with large-objects
  In-Reply-To: <199910030414.OAA26402@mugca.cc.monash.edu.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox