Обсуждение: lo_export and lo_import: paths and servers

Поиск
Список
Период
Сортировка

lo_export and lo_import: paths and servers

От
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

Вложения

Re: lo_export and lo_import: paths and servers

От
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

Вложения