From: | Marco Colombo <pgsql(at)esiway(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Good Delimiter for copy command |
Date: | 2009-02-17 16:17:40 |
Message-ID: | 499AE324.4070908@esiway.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Tom Lane wrote:
> Andrew Gould <andrewlylegould(at)gmail(dot)com> writes:
>> To the list: Does pg_dump escape characters that are the same as the
>> delimiter?
>
> Yes. The OP has not actually explained why he needs to pick a
> nondefault delimiter, unless maybe it is that he wants to feed the
> dump to some program that is too dumb to deal with escaping.
>
> regards, tom lane
>
Which makes me wonder, does copy accept UTF-8 input? Is it possibile
to use some unicode character which is unlikely to appear in the data
set as delimiter? Something like U+FFFC.
Here I'm using U+25CF for it's much more likely you can see it
(it's a black circle).
$ python -c 'print u";".join("ABCD").encode("utf8")' > 1.txt
$ cat 1.txt
A;B;C;D
$ python -c 'print u"\u25cf".join("ABCD").encode("utf8")' > 2.txt
$ cat 2.txt
A●B●C●D
$ psql -c "\d test"
Table "public.test"
Column | Type | Modifiers
--------+------+-----------
a | text |
b | text |
c | text |
d | text |
$ psql -c "\copy test from '1.txt' delimiter ;"
$ psql -c "\copy test from '2.txt' delimiter ●"
ERROR: COPY delimiter must be a single character
\copy: ERROR: COPY delimiter must be a single character
It doesn't seem to work, but I need to stress that I'm using
$ psql --version
psql (PostgreSQL) 8.2.9
.TM.
From | Date | Subject | |
---|---|---|---|
Next Message | Sam Mason | 2009-02-17 16:40:58 | Re: hi all |
Previous Message | Alvaro Herrera | 2009-02-17 16:11:47 | Re: [GENERAL] 8.3 doc issue |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-02-17 16:22:35 | Re: PL/Perl translation, croak |
Previous Message | decibel | 2009-02-17 16:14:56 | Re: The science of optimization in practical terms? |