[HACKERS] lo_export and lo_import: paths and servers

2007-11-29 Thread Jorgen Austvik - Sun Norway

Hi,

The PostgreSQL 8.3 documentation[1] says this about lo_export and 
lo_import paths and servers:


Import:

   Note that the file is read by the client interface library, not by
   the server; so it must exist in the client file system and be
   readable by the client application.

Export:

   Note that the file is written by the client interface library, not by
   the server.

The way I read this is that both for lo_import and lo_export, the files 
should be placed (and be readable) on the local file system for the client.


However, the behaviour I see when I run pg_regress and the large in 
client/server mode over two different hosts, is that pg_export works 
against the server file system (the file is written there), while 
pg_import work against the client file system (the file is not there 
when it tries to read it), leading to the result below.


Problem between keyboard and chair, in doc, libpq, psql or elsewhere?

-8--8--8--8--8
SELECT lo_export(loid, 
'/export/home/tmp/jagtmp/ja155679pgRegress/install/share/regress/results/lotest.txt') 
FROM lotest_stash_values;

 lo_export
---
 1
(1 row)

\lo_import 
'/export/home/tmp/jagtmp/ja155679pgRegress/install/share/regress/results/lotest.txt'
could not open file 
/export/home/tmp/jagtmp/ja155679pgRegress/install/share/regress/results/lotest.txt: 
No such file or directory

\set newloid :LASTOID
-- just make sure \lo_export does not barf
\lo_export :newloid 
'/export/home/tmp/jagtmp/ja155679pgRegress/install/share/regress/results/lotest2.txt'

ERROR:  large object 0 does not exist
-8--8--8--8--8

[1] http://www.postgresql.org/docs/8.3/static/lo-interfaces.html

-J
--

Jørgen Austvik, Software Engineering - QA
Sun Microsystems Database Technology Group
begin:vcard
fn;quoted-printable:J=C3=B8rgen Austvik
n;quoted-printable:Austvik;J=C3=B8rgen
org:Sun Microsystems;Database Technology Group
adr:;;Haakon VIII gt. 7b;Trondheim;;NO-7485;Norway
email;internet:[EMAIL PROTECTED]
title:Senior Engineer
tel;work:+47 73 84 21 10 
tel;fax:+47 73 84 21 01
tel;cell:+47 901 97 886
x-mozilla-html:FALSE
url:http://www.sun.com/
version:2.1
end:vcard


---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [HACKERS] lo_export and lo_import: paths and servers

2007-11-29 Thread Jorgen Austvik - Sun Norway

Jorgen Austvik - Sun Norway wrote:

Problem between keyboard and chair, in doc, libpq, psql or elsewhere?


Sorry, the psql documentation is clear on this:

\lo_export

Note that this is subtly different from the server function lo_export, 
which acts with the permissions of the user that the database server 
runs as and on the server's file system.


\lo_import

Note that this command is subtly different from the server-side 
lo_import because it acts as the local user on the local file system, 
rather than the server's user and file system.


-J
--

Jørgen Austvik, Software Engineering - QA
Sun Microsystems Database Technology Group
begin:vcard
fn;quoted-printable:J=C3=B8rgen Austvik
n;quoted-printable:Austvik;J=C3=B8rgen
org:Sun Microsystems;Database Technology Group
adr:;;Haakon VIII gt. 7b;Trondheim;;NO-7485;Norway
email;internet:[EMAIL PROTECTED]
title:Senior Engineer
tel;work:+47 73 84 21 10 
tel;fax:+47 73 84 21 01
tel;cell:+47 901 97 886
x-mozilla-html:FALSE
url:http://www.sun.com/
version:2.1
end:vcard


---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate