Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux