Re: COPY formatting
От | Bruce Momjian |
---|---|
Тема | Re: COPY formatting |
Дата | |
Msg-id | 200403191901.i2JJ1Hu20522@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: COPY formatting ("Thomas Swan" <tswan@idigx.com>) |
Ответы |
Re: COPY formatting
|
Список | pgsql-hackers |
Thomas Swan wrote: > > I have never seen such a beast, and if I had been asked off the cuff > > would have said that it was probably illegal, except that I know of no > > standard actually defining the format. Perhaps others (Joshua Drake or > > Josh Berkus?) have wider experience. I think in any case we should > > ignore those for now and handle the straightforward case. > > > > I *have* seen monstrosities like fields that do not begin with the quote > > character but then break into a quote, e.g.: > > > > 1,2,a,123"abc""def",6,7,8 > > > > I have dealt with both, frequently. The CSV format allows you to begin a > block of text with the quote. Newlines are included in that quoted space. > If qoutes are included in the field then the quotes are double quotes to > denote they are not part of the quoted space. > > Also, the following is valid. > > 1,2,,,"",,,"" > > "" is empty. > > 1,2,3,"""",,,,"", > > The 4 quotes denote a single double quote. > > Writing simple CSV converts that just explode on commas and newlines miss > these oddities. OK, so for the separator, quote, and escape options: separator is ,quote is "escape is " so if the quote and escape are the same, then a double denotes a single? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
В списке pgsql-hackers по дате отправления: