Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] how to save a bytea value into a file?

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>,"fanlijing *EXTERN*" <fanlijing(at)cn(dot)fujitsu(dot)com>,<pgsql-admin(at)postgresql(dot)org>,<pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] how to save a bytea value into a file?
Date: 2011-10-10 14:26:26
Message-ID: D960CB61B694CF459DCFB4B0128514C206F74397@exadv11.host.magwien.gv.at (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-general
I wrote:
[fanlijing wants to write bytea to file]
> A simple
>    COPY (SELECT byteacol WROM mytab WHERE ...) TO 'filename' (FORMAT
binary)
> should do the trick.

Corrections:
a) "binary" must be surrounded by single quotes.
b) that won't dump just the binary data - you would have
   to remove the first 25 bytes and the last 2 bytes...

So maybe using the functions I mentioned would be the
best way after all.

You could also write your own user defined function in C.

Yours,
Laurenz Albe

In response to

Responses

pgsql-admin by date

Next:From: Merlin MoncureDate: 2011-10-10 15:51:14
Subject: Re: [GENERAL] how to save a bytea value into a file?
Previous:From: jesperDate: 2011-10-10 14:17:05
Subject: pg_lesslog

pgsql-general by date

Next:From: hubert depesz lubaczewskiDate: 2011-10-10 14:48:07
Subject: Re: a dumb question regarding RULES
Previous:From: Rafal PietrakDate: 2011-10-10 14:06:34
Subject: a dumb question regarding RULES

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group