Large Object / libPQ : problem

Started by Chrisover 25 years ago2 messagesbugs
Jump to latest
#1Chris
linux.fellow@libertysurf.fr

Hi, all.

I'm encoutering a problem with libpq when opening a large object.
If I use lo_import within psql, there's no problem. But when I use
the libpq functions 'lo_open', the function fails. (also, lo_import
fails
in the call to lo_open.) After some experiments, I found that the
lo_open
function seemed to work at open-time, but it's calling 'lo_lseek' just
after,
and that seems not to work. (invalid descriptor 0).

This causes many problems, coz I really need that functionnality. (as
'Binary'
type is not yet implemented... and would be quite the same !)

Infos :

System: Linux 2.2.x (with libc GLibc 2.1.3)
Arch: Intel x86 (AMB K6-II and AMD Athlon)
CC: gcc (tryed both pgcc and gcc 2.98)
PostgreSQL: postgres-7.0.2

[note: I found a message that seemes to show a similar problem in the
base, it
was posted by Alexey Kobozev]

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chris (#1)
Re: Large Object / libPQ : problem

Chris <linux.fellow@libertysurf.fr> writes:

the libpq functions 'lo_open', the function fails. (also, lo_import
fails in the call to lo_open.) After some experiments, I found that
the lo_open function seemed to work at open-time, but it's calling
'lo_lseek' just after, and that seems not to work.

It sounds like you are neglecting to wrap the whole process in a
transaction block (BEGIN/COMMIT). The LO handle returned by lo_open
is valid only as long as you keep the current transaction open.

regards, tom lane