Re: Two small questions re/ COPY CSV data into table

Поиск
Список
Период
Сортировка
От Matthias Apitz
Тема Re: Two small questions re/ COPY CSV data into table
Дата
Msg-id 20190604172054.GA4376@sh4-5.1blu.de
обсуждение исходный текст
Ответ на Re: Two small questions re/ COPY CSV data into table  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Ответы Re: Two small questions re/ COPY CSV data into table  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: Two small questions re/ COPY CSV data into table  (Matthias Apitz <guru@unixarea.de>)
Список pgsql-general
El día Tuesday, June 04, 2019 a las 05:56:49PM +0100, Andrew Gierth escribió:

>  Matthias> The new DELIMITER for PG is then vtab and the | is just a char in the
>  Matthias> data (in the example above a pipe of two UNIX cmd).
> 
> Yes, but why?
> 
> If you use COPY ... WITH DELIMITER '|' (i.e. text mode, not CSV mode)
> then the \| is accepted as being a literal | and the unescaped | is
> treated as a delimiter. What is the point of the substitutions?

In the original data record in Sybase there is a column containing, i.e.
some UNIX print command to be read and executed by the application:

    cmd | lpr ...

it is exported into the file as

    cmd \| lpr ...

because the export delimiter is set to '|';

the COPY in text mode was complaining because it interpreted the |
of the sequence \| as an delimiter and the number of columns did not
matched.

I will provide tomorrow the exact input line, the exact COPY command and
the error.

    matthias

-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!



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

Предыдущее
От:
Дата:
Сообщение: Re: psql \copy
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: Two small questions re/ COPY CSV data into table