Re: lo_import

From: Patrick Nelson <pnelson(at)neatech(dot)com>
To: "PostgreSQL List (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: lo_import
Date: 2002-08-11 21:21:38
Message-ID: 4165C48DE9A0D211B6400800095C585F172E09@WASHINGTON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-08-11 21:58:24 Re: After upgrade pg_dumpall fails
Previous Message Patrick Nelson 2002-08-11 20:30:17 Re: After upgrade pg_dumpall fails (SOLVED)