Tom Lane wrote:
> Andrew Gould <andrewlylego...@gmail.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.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to