Thread: Large object - what's happening?

Large object - what's happening?

From
Cath Lawrence
Date:
Hi,

I decided how to deal with my large objects, and now I'm trying to get
them going in a python script.

I'm using pygresql. Is this considered a good thing? Should I use
something else? The syntax looks so simple - just  loimport(filename)

I get a python error:
_pg.err: can't create large object

In the postmaster log is a one-liner:
ERROR:  lo_lseek: invalid large obj descriptor (0)

Maybe I'm calling it wrong. Maybe I need to upgrade from 7.2.1 to
7.3.x?  Maybe I need a new book - Practical Postgresql is very light on
discussion of large objects, and is based on 7.1 or so.

Any clues? Pointers to documents?

thanks
Cath
Cath Lawrence,                       Cath.Lawrence@anu.edu.au
Senior Scientific Programmer,  Centre for Bioinformation Science,
John Curtin School of Medical Research (room 4088)
Australian National University,  Canberra ACT 0200
ph: (02) 61257959   mobile: 0421-902694   fax: (02) 61252595


Re: Large object - what's happening?

From
Warwick Hunter
Date:
Cath

> I get a python error:
> _pg.err: can't create large object
>
> In the postmaster log is a one-liner:
> ERROR:  lo_lseek: invalid large obj descriptor (0)

Make sure that you are doing the large object manipulation
inside a transaction. I saw this type of error from the
C interface when I forgot to wrap it in a transaction.

It could also be caused by permissions. I think your
database user needs some special priveleges to be able
to create large objects.

Warwick
--
Warwick Hunter                    Agile TV Corporation
Voice: +61 7 5584 5912            Fax: +61 7 5575 9550
mailto:whunter@agile.tv           http://www.agile.tv


Re: Large object - what's happening?

From
Cath Lawrence
Date:
On Friday, August 15, 2003, at 09:19  AM, Warwick Hunter wrote:
> Cath
>> I get a python error:
>> _pg.err: can't create large object
>> In the postmaster log is a one-liner:
>> ERROR:  lo_lseek: invalid large obj descriptor (0)
> Make sure that you are doing the large object manipulation
> inside a transaction. I saw this type of error from the
> C interface when I forgot to wrap it in a transaction.

Thanks for the tip, but how do I do this?

I have pygresql 3.3 and have gone through the readme thoroughly, and it
says nothing about it. I assumed each call to the database must be a
transaction.

> It could also be caused by permissions. I think your
> database user needs some special priveleges to be able
> to create large objects.

It's not this - when I am in command line psql mode I can use
\lo_import, and it works fine.
It's just my python script that fails.

thanks
C
Cath Lawrence,                       Cath.Lawrence@anu.edu.au
Senior Scientific Programmer,  Centre for Bioinformation Science,
John Curtin School of Medical Research (room 4088)
Australian National University,  Canberra ACT 0200
ph: (02) 61257959   mobile: 0421-902694   fax: (02) 61252595


Re: Large object - what's happening?

From
Warwick Hunter
Date:
> Thanks for the tip, but how do I do this?

I am afraid I cannot help you with respect to Python.

Warwick
--
Warwick Hunter                    Agile TV Corporation
Voice: +61 7 5584 5912            Fax: +61 7 5575 9550
mailto:whunter@agile.tv           http://www.agile.tv