Re: how to save a bytea value into a file?

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: how to save a bytea value into a file?
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C206F740C4@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на how to save a bytea value into a file?  ("fanlijing" <fanlijing@cn.fujitsu.com>)
Ответы Re: how to save a bytea value into a file?
Список pgsql-general
fanlijing wrote:
> When I want to save a bytea value into a file, what should I do?
> Is there any function dealing with that in PostgreSQL? (like lo_export() to
> deal with the large-object) (# I didn't find any....)

If you want to save it in a file on the server, you can use
the COPY statement.

If you want to create that file on the client machine, you'll
have to select and fetch it like any other value, then open
a file and write the contents into it.

If the bytea is large, you could select parts of it (with the
substring() function) and thus do it in pieces.

For some APIs, you could also use COPY TO STDOUT.

Details depend on the API and programming language you are using.

Yours,
Laurenz Albe

В списке pgsql-general по дате отправления:

Предыдущее
От: Harshitha S
Дата:
Сообщение: could not create file "base/16384/11500": File exists
Следующее
От: AI Rumman
Дата:
Сообщение: Permission for pg_shadow.