From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | David Rysdam <drysdam(at)ll(dot)mit(dot)edu>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: I want the stupidest possible binary export |
Date: | 2014-09-18 14:24:05 |
Message-ID: | 541AEB05.8090105@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 09/18/2014 07:06 AM, David Rysdam wrote:
> I've got a some tables with bytea fields that I want to export only the
> binary data to files. (Each field has a gzipped data file.)
>
> I really want to avoid adding overhead to my project by writing a
> special program to do this, so I'm trying to do it from psql. Omitting
> the obvious switches for username, etc, here's what I'm doing:
>
> psql -t -c "\copy (select mybinaryfield from mytable where key = 1) to
> 'file'"
>
> That works, but I get escaped bytes. I want actual binary directly out
> of the DB. Another option might be:
>
> psql -t -c "\copy (select mybinaryfield from mytable where key = 1) to
> 'file'" with format binary
From here:
http://www.postgresql.org/docs/9.2/static/app-psql.html
the above should be:
psql -t -c "\copy (select mybinaryfield from mytable where key = 1) to
'file'" with binary
>
> However, there are two problems. First, I get an syntax error "at or
> near 'format'". (Running 9.2 client and server.) And second, I suspect
> that'll be some "proprietary" PG format, not the actual bytes from just
> my field.
>
> What option am I missing?
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Jov | 2014-09-18 14:55:33 | Re: I want the stupidest possible binary export |
Previous Message | Szymon Guz | 2014-09-18 14:21:55 | Re: I want the stupidest possible binary export |