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:06:51 |
Message-ID: | 5406073B.6080506@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 09/02/2014 01:28 AM, swaroop wrote:
>
> Thanks for getting back.
>
> So just to confirm if a string value , we need to take care off it ourselves
> by escaping
> any special character and quote (single, double) ? I am not exactly sure off
> the escaping part
> for each of the characters - have read that for single quotes, we need to
> add one more single
> quote to escape . Is this true ? Please can you confirm this and
> specifically for any other character.
>
> basically i want to ensure that if i get a string say abc'd"e\fgh/" or
> something which has characters
> i need to escape, i need to be aware off which are those characters for
> which copy command
> can consider it as invalid CSV.
A good place to start is:
http://www.postgresql.org/docs/9.3/interactive/sql-copy.html
CSV Format
"....
The values in each record are separated by the DELIMITER character. If
the value contains the delimiter character, the QUOTE character, the
NULL string, a carriage return, or line feed character, then the whole
value is prefixed and suffixed by the QUOTE character, and any
occurrence within the value of a QUOTE character or the ESCAPE character
is preceded by the escape character. You can also use FORCE_QUOTE to
force quotes when outputting non-NULL values in specific columns. ..."
There is more, so I would read the whole section.
>
> Currently using this COPY table(col1,col2,...coln) FROM STDIN WITH CSV NULL
> AS 'NULL-VAL' , new ByteArrayInputStream(bytes)
>
>
> thanks again.
>
>
>
>
> --
> View this message in context: http://postgresql.1045698.n5.nabble.com/copymanager-question-tp5817197p5817315.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2014-09-02 18:08:49 | Re: copymanager question |
Previous Message | swaroop | 2014-09-02 17:12:54 | Re: copymanager question |