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

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: Two small questions re/ COPY CSV data into table
Дата
Msg-id 87blzd8fdq.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: Two small questions re/ COPY CSV data into table  (Matthias Apitz <guru@unixarea.de>)
Ответы Re: Two small questions re/ COPY CSV data into table  (Matthias Apitz <guru@unixarea.de>)
Список pgsql-general
>>>>> "Matthias" == Matthias Apitz <guru@unixarea.de> writes:

 Matthias> sed 's/|/\v/g' < table-from-Sybase  | sed 's/\\\v/|/g' > table-for-copy
 
 >> What on earth is this supposed to achieve?

 Matthias> It first translates any char '|' to vtab and then any '\vtab'
 Matthias> (i.e. a backslash followed by a vtab) back to the char |

 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?

-- 
Andrew (irc:RhodiumToad)



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

Предыдущее
От: Rob Northcott
Дата:
Сообщение: Query very different speeds on seemingly similar data
Следующее
От:
Дата:
Сообщение: Re: psql \copy