Re: Parsing COPY ... WITH BINARY

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Leonardo M(dot) Ramé <l(dot)rame(at)griensu(dot)com>
Cc: PostgreSql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Parsing COPY ... WITH BINARY
Date: 2013-01-31 23:38:26
Message-ID: CAHyXU0x0DuageBEOKFdXHO3O-6N3oV1By5ZsR=iFgkYAzv-aNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 31, 2013 at 8:47 AM, Leonardo M. Ramé <l(dot)rame(at)griensu(dot)com> wrote:
> I'm using this:
>
> COPY( select field1, field2, field3 from table ) TO 'C://Program Files/PostgreSql//8.4//data//output.dat' WITH BINARY
>
> To export some fields to a file, one of them is a ByteA field. Now, I
> need to read the file with a custom made program.
>
> How can I parse this file?
>
> BTW: I cannot export as CSV, because the binary data is modified when I
> do that.

this type of thing is probably better handled with libpq based C
application if you're willing to write one. all this is assuming you
don't want to decode your bytea from encoded format such as hex. why
do you specifically need to dump in binary?

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Carlo Stonebanks 2013-02-01 05:19:05 Re: Pg & Tcl - is it dying out?
Previous Message Adrian Klaver 2013-01-31 23:00:46 Re: Pg & Tcl - is it dying out?