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

Поиск
Список
Период
Сортировка
От Matthias Apitz
Тема Re: Two small questions re/ COPY CSV data into table
Дата
Msg-id 20190604150318.GA13915@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>)
Список pgsql-general
El día Tuesday, June 04, 2019 a las 11:32:45AM +0100, Andrew Gierth escribió:

>  Matthias> 2. The CSV export is done by some Sybase tool which escapes
>  Matthias> the delimiter as '\|', i.e. putting a backslash before the
>  Matthias> delimiter. I found no way that COPY understands this
>  Matthias> excaping. Any ideas?
> 
> That sounds like the file is not actually a CSV - why do you think it
> is?
> 
> ...

Well, it's not strictly CSV, but it is what the Sybase tool produces. The
delimiter is set to '|' and a data example line looks like:

0|1| cat $1 \| lpr -Pprinter |3|4

I do load this now with COPY in mode TEXT and modify the data before
with:

 sed 's/|/\v/g' < table-from-Sybase  | sed 's/\\\v/|/g' > table-for-copy

Works fine.

    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 по дате отправления:

Предыдущее
От: Jeremy Finzel
Дата:
Сообщение: Re: Questions about btree_gin vs btree_gist for low cardinality columns
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: Two small questions re/ COPY CSV data into table