pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Miguel García <rocho08@yahoo.es>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: lo_write and lo_import does not work!
Date: Wed, 18 Apr 2007 10:02:47 -0400
Message-ID: <20070418140247.GA7356@alvh.no-ip.org> (raw)
In-Reply-To: <471146.38834.qm@web26607.mail.ukl.yahoo.com>
References: <471146.38834.qm@web26607.mail.ukl.yahoo.com>

Miguel García escribió:
> Hello,
> 
> I have a little trouble using large objects with libpq an postgresql
> 8.2 in windows xp professional SP2.
> 
> I want to save and load large objects from/to database, but its fails.
> 
> If i try to use the lo_import() function
> 
> #define FILE_IN "d:/question-icon.png"
> Oid file_oid = lo_import (conn, FILE_IN);
> 
> file_oid always have 0 value, nevertheless the large object has been created in table
> pg_largeobject, but has no data.

I think your problem is that you are not running the commands inside a
transaction.  Large object IDs are closed at the end of the transaction
block, which is right after the lo_open unless you're calling BEGIN
first (or are not in autocommit mode, which is the default).

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



view thread (3+ messages)  latest in thread

Message-ID: <20070418140247.GA7356@alvh.no-ip.org>
Permalink:  ../20070418140247.GA7356@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20070418140247.GA7356@alvh.no-ip.org

 · 

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: alvherre@commandprompt.com, rocho08@yahoo.es
  Subject: Re: lo_write and lo_import does not work!
  In-Reply-To: <20070418140247.GA7356@alvh.no-ip.org>

* 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