Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] Postgresql + lo

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Florian Baumert <baumert(at)plt(dot)de>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Postgresql + lo
Date: 1999-07-23 13:57:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Florian Baumert <baumert(at)plt(dot)de> writes:
> What happens is that it writes a -1 to the screen and a database-error
> "ERROR: lo_lseek: invalid large obj descriptor (0)"

You need "begin transaction"/"end transaction" around the use of the
LO handle (ie, surrounding lo_open ... lo_close).

The documentation has always stated that lo_open must be wrapped in
a transaction, but Postgres versions before 6.5 didn't enforce that
rule.  (Instead, they'd just fail occasionally if you broke it :-(.)

6.5 enforces the rule by auto-closing LO handles at transaction
commit --- which will be instantly upon completion of the lo_open
command, if you are not inside a transaction; so the first attempt
to do anything with the handle will draw "invalid large obj

This is definitely getting to be a FAQ...

			regards, tom lane


pgsql-interfaces by date

Next:From: Tom LaneDate: 1999-07-23 14:05:36
Subject: Re: [INTERFACES] New asynchronous tcl postgresql interface
Previous:From: secretDate: 1999-07-23 13:41:47
Subject: S1C00: Only SQL_POSITION/REFRESH is supported for SQLSetPos

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group