Re: copymanager question

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: swaroop <swaroop(dot)belur(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: copymanager question
Date: 2014-09-02 18:08:49
Message-ID: 540607B1.9070805@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 09/02/2014 03:20 AM, 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.

My solution is either quote the entire string or use a different
delimiter. I usually use | as it not often found in data.

>
> 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)
>
>
>
> --
> View this message in context: http://postgresql.1045698.n5.nabble.com/copymanager-question-tp5817197p5817334.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Dung 2014-09-02 18:14:23 Question about gin index not used on a tsv column
Previous Message Adrian Klaver 2014-09-02 18:06:51 Re: copymanager question