fix CSV multiline parsing - proof of concept

Started by Andrew Dunstanalmost 22 years ago1 messagespatches
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

Attached is a proof-of-concept patch (i.e. not intended for application
just yet) to fix the problem of parsing CSV multiline fields.

Originally I indicated that the way to solve this IMHO was to the
combine reading and parsing phases of COPY for CSV. However, there's a
lot going on there and I adopted a somewhat less invasive approach,
which detects if a CR and/orNL should be part of a data value and if so
treats it as just another character. Also, it removes the escaping
nature of backslash for NL and CR in CSV, which is clearly a bug.

One thing I noticed is that (unless I misread the code) our standard
detection of the end marker \.<EOL> doesn't seem to require that it be
at the beginning of a line, as the docs say it should. I didn't change
that but did build a test for it into the special CSV code.

comments welcome.

cheers

andrew

Attachments:

copy-csv-multiline.patchtext/x-patch; name=copy-csv-multiline.patchDownload+237-30