I want the stupidest possible binary export - Mailing list pgsql-general

From David Rysdam
Subject I want the stupidest possible binary export
Date
Msg-id 87oaudrpjo.fsf@loud.ll.mit.edu
Whole thread Raw
Responses Re: I want the stupidest possible binary export  (Szymon Guz <mabewlun@gmail.com>)
Re: I want the stupidest possible binary export  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: I want the stupidest possible binary export  (Jov <amutu@amutu.com>)
List pgsql-general
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

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?


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: strange problem with not existing roles
Next
From: Szymon Guz
Date:
Subject: Re: I want the stupidest possible binary export