Re: copymanager question

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: copymanager question
Дата
Msg-id 1409661802759-5817357.post@n5.nabble.com
обсуждение исходный текст
Ответ на copymanager question  (swaroop <swaroop.belur@gmail.com>)
Ответы Re: copymanager question  (swaroop <swaroop.belur@gmail.com>)
Список pgsql-general
swaroop wrote
> one more - i also need to insert useragent strings which have all sorts of
> characters in them eg
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML,
> like Gecko) Chrome/0.2.149.29 Safari/525.13
>
> Here there is a comma which causes the copy to fail. Other words do not
> have comma in them.
>
> Can you please point me to the correct way to escape this ?
>
> To summarize - how do i replace the input strings in java (data is
> streamed in and i do a copy to postgres)
> so that CSV copy does not fail.
> a. words with comma
> b. words with double quotes in them
> c. words with \ (backslash)

In CSV (comma), strings are to be surrounded with double-quotes.  These are
optional unless the string can contain a comma or double-quote itself.
Inside a double-quoted strong a comma is just a comma.  A double-quote has
to be escapedd but doubling it.  "String ""quote"" , string". Backslash
doesn't do anything special.

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/copymanager-question-tp5817197p5817357.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: Arnaud Lesauvage
Дата:
Сообщение: Re: Expected behaviour of \d in regexp with exponent numbers ?
Следующее
От: Vick Khera
Дата:
Сообщение: Re: Expected behaviour of \d in regexp with exponent numbers ?