Re: Good Delimiter for copy command

Поиск
Список
Период
Сортировка
От Marco Colombo
Тема Re: Good Delimiter for copy command
Дата
Msg-id 499AE324.4070908@esiway.net
обсуждение исходный текст
Ответ на Re: Good Delimiter for copy command  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Good Delimiter for copy command  (Mark Roberts <mailing_lists@pandapocket.com>)
Re: Good Delimiter for copy command  (David Fetter <david@fetter.org>)
Список pgsql-general
Tom Lane wrote:
> Andrew Gould <andrewlylegould@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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Sam Mason
Дата:
Сообщение: Re: hi all
Следующее
От: Owen Hartnett
Дата:
Сообщение: Re: Attempting to connect