Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 6A2629FB837 for ; Wed, 18 Apr 2007 11:02:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 31589-08 for ; Wed, 18 Apr 2007 11:02:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 61B409FB7AA for ; Wed, 18 Apr 2007 11:02:51 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-221-161.bk12-dsl.surnet.cl [201.221.221.161]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l3IE2oBP019900; Wed, 18 Apr 2007 07:02:51 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id DEB2E32A0C; Wed, 18 Apr 2007 10:02:47 -0400 (CLT) Date: Wed, 18 Apr 2007 10:02:47 -0400 From: Alvaro Herrera To: Miguel =?iso-8859-1?Q?Garc=EDa?= Cc: pgsql-interfaces@postgresql.org Subject: Re: lo_write and lo_import does not work! Message-ID: <20070418140247.GA7356@alvh.no-ip.org> Mail-Followup-To: Miguel =?iso-8859-1?Q?Garc=EDa?= , pgsql-interfaces@postgresql.org References: <471146.38834.qm@web26607.mail.ukl.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <471146.38834.qm@web26607.mail.ukl.yahoo.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Wed, 18 Apr 2007 07:02:51 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/11 X-Sequence-Number: 6499 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