inserting non-printable character in varchar when CLIENT_ENCODING is SQL_ASCII

From: Antha Lamus <anthalamus(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: inserting non-printable character in varchar when CLIENT_ENCODING is SQL_ASCII
Date: 2011-03-24 19:57:22
Message-ID: AANLkTi=7uZyCyoL-g-Ke=rjLKK5j67C9_=ugZXXPRf5+@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all,
i get the following error when attempting to do what's described in the
title:

mytest=> \copy "public"."mytable4" ("my_int", "my_string") FROM data.dump
DELIMITER E'\t' NULL 'NULL' CSV HEADER
ERROR: unterminated CSV quoted field
CONTEXT: COPY mytable4, line 3: "54 "hello
a \great d"

I'm not necessarily trying to insert a \0, i'd actually like to be able to
insert any byte without resorting to using a bytea. i understood that this
was what SQL_ASCII was intended for!
http://www.postgresql.org/docs/8.4/interactive/sql-copy.html also states
that the \NNN or \xNN format works but I was never able to actually work (it
stores "\", then "N" then ...)

Any help would be greatly appreciated as i've already spent hours on that
matter..!
Thanks a lot in advance,
Anthony

PS: some context that may help:
psql (8.4.7, server 8.3.11)
mytest=> SHOW SERVER_ENCODING;
SQL_ASCII
mytest=> SHOW CLIENT_ENCODING;
SQL_ASCII
mytest=> CREATE TABLE "public"."mytable4" (
"my_int" integer,
"my_string" character varying(64)
);
cat data.dump | od -c
0000000 m y _ i n t \t m y _ s t r i n g
0000020 \n 5 4 \t " h e l l o \0 w o r l d
0000040 " \n

Browse pgsql-novice by date

  From Date Subject
Next Message David Patricola 2011-03-24 20:02:47 SSL test using psql fails
Previous Message Mathieu Dubois 2011-03-24 13:21:20 Re: How many digits are printed with double precision?