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

copy ... from stdin csv; and bytea

From: "David Wilson" <david(dot)t(dot)wilson(at)gmail(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: copy ... from stdin csv; and bytea
Date: 2008-07-28 04:18:16
Message-ID: e7f9235d0807272118q202f30a5kf9ff55e314604254@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
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?

Using 8.3.3, and this is specifically via libpq, if that makes a difference.

Thanks much.
-- 
- David T. Wilson
david(dot)t(dot)wilson(at)gmail(dot)com

Responses

pgsql-general by date

Next:From: Craig RingerDate: 2008-07-28 04:28:29
Subject: Re: Getting data from Xml to Postgresql database
Previous:From: Sushant SinhaDate: 2008-07-28 02:06:50
Subject: Re: Profiling postgres

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