Re: Should CSV parsing be stricter about mid-field quotes?
От | Andrew Dunstan |
---|---|
Тема | Re: Should CSV parsing be stricter about mid-field quotes? |
Дата | |
Msg-id | 9f1e32aa-1267-7d8e-0472-66a04b83d2ea@dunslane.net обсуждение исходный текст |
Ответ на | Re: Should CSV parsing be stricter about mid-field quotes? ("Joel Jacobson" <joel@compiler.org>) |
Ответы |
Re: Should CSV parsing be stricter about mid-field quotes?
(Tom Lane <tgl@sss.pgh.pa.us>)
|
Список | pgsql-hackers |
Maybe this is unexpected by you, but it's not by me. What other sane interpretation of that data could there be? And what CSV producer outputs such horrible content? As you've noted, ours certainly does not. Our rules are clear: quotes within quotes must be escaped (default escape is by doubling the quote char). Allowing partial fields to be quoted was a deliberate decision when CSV parsing was implemented, because examples have been seen in the wild.
So I don't think our behaviour is broken or needs fixing. As mentioned by Greg, this is an example of the adage about being liberal in what you accept.
I'm pretty reluctant to change something that's been working as designed for almost 20 years, and about which we have hitherto had zero complaints that I recall.
I could see an argument for a STRICT mode which would disallow partially quoted fields, although I'd like some evidence that we're dealing with a real problem here. Is there really a CSV producer that produces output like that you showed in your example? And if so has anyone objected to them about the insanity of that?
cheers
andrew
-- Andrew Dunstan EDB: https://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: