Re: copy ... from stdin csv; and bytea

From: Klint Gore <kgore4(at)une(dot)edu(dot)au>
To: David Wilson <david(dot)t(dot)wilson(at)gmail(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: copy ... from stdin csv; and bytea
Date: 2008-07-28 05:24:57
Message-ID: 488D5829.2070909@une.edu.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Wilson wrote:
> My application is adding a bytea column to a table into which data is
> dumped in approximately 4k row batches, one batch approximately every
> 10 seconds. To this point, those dumps have used copy from stdin;
> however, I'm having some difficulty getting bytea encodings to work
> with it. Specifically, I can't seem to get the parser to recognize
> that what I'm handing it is an escaped string that needs to be parsed
> back into individual bytes rather than stored as-is. The encoding is
> very straightforward for INSERT, of course, but the COPY ... FROM
> STDIN CSV doesn't seem to want to work no matter what I've tried:
>
> \\000
> "\\000"
> "E'\\000'"
>
> etc.
>
> Is there a trick to this that I just didn't see in the documentation,
> or is this some limitation of CSV copy-in? If the latter, are there
> suggestions for workarounds other than to fallback on the inserts?
>
Try just a single \

e.g.
"ge.xls","application/vnd.ms-excel",71168,"\320\317\021\340\241[snip]

klint.

--
Klint Gore
Database Manager
Sheep CRC
A.G.B.U.
University of New England
Armidale NSW 2350

Ph: 02 6773 3789
Fax: 02 6773 3266
EMail: kgore4(at)une(dot)edu(dot)au

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Wilson 2008-07-28 05:39:56 Re: copy ... from stdin csv; and bytea
Previous Message Craig Ringer 2008-07-28 04:28:29 Re: Getting data from Xml to Postgresql database