Re: lo_import - Mailing list pgsql-general

From Patrick Nelson
Subject Re: lo_import
Date
Msg-id 4165C48DE9A0D211B6400800095C585F172E09@WASHINGTON
Whole thread Raw
In response to lo_import  (Patrick Nelson <pnelson@neatech.com>)
List pgsql-general
Cornelia Boenigk wrote:
----------------->>>>
docgen=# CREATE TABLE fotos (name CHAR(15), bild OID);
CREATE
docgen=# INSERT INTO fotos VALUES
docgen-# ('eule',lo_import('/home/conni/eule.gif'));
INSERT 18999 1
docgen=# SELECT * FROM fotos;
 name              |  bild
-------------------+----------
 eule             | 18999
(1 row)

docgen=#  SELECT lo_export(fotos.bild, '/tmp/euleout.gif')
docgen-# FROM fotos WHERE name = 'eule';
 lo_export
-----------
         1
(1 row)

docgen=# SELECT lo_unlink(fotos.bild) FROM fotos WHERE name = 'eule';
 lo_unlink
-----------
         1
(1 row)
----------------->>>>

That works fine if your /home/conni/eule.gif is on the server, but what I
was wanting was the process to insert when your on a remote system and your
/home/conni/eule.gif is on the remote system not the server.  You can use
the \lo_import <filename> to import a local file to the server, which then
can be seen with \lo_list and exported with \lo_export and then \lo_unlink
if you wish.

How do you put the OID into bild from the large objects list?  I'm not sure
what the use of \lo_<cmd> is?

pgsql-general by date:

Previous
From: Patrick Nelson
Date:
Subject: Re: After upgrade pg_dumpall fails (SOLVED)
Next
From: Tom Lane
Date:
Subject: Re: After upgrade pg_dumpall fails