Re: Should CSV parsing be stricter about mid-field quotes?

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Joel Jacobson" <joel(at)compiler(dot)org>
Cc: "Andrew Dunstan" <andrew(at)dunslane(dot)net>,pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Should CSV parsing be stricter about mid-field quotes?
Date: 2023-05-19 16:06:34
Message-ID: bd0f8ba9-2dfa-4fe3-be5d-30b000bca8c4@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joel Jacobson wrote:

> I understand its necessity for STDIN, given that the end of input needs to
> be explicitly defined.
> However, for files, we have a known file size and the end-of-file can be
> detected without the need for special markers.
>
> Also, is the difference in how server-side COPY CSV is capable of dealing
> with \. but apparently not the client-side \COPY CSV documented somewhere?

psql implements the client-side "\copy table from file..." with
COPY table FROM STDIN ...

COPY FROM file CSV somewhat differs as your example shows,
but it still mishandle \. when unquoted. For instance, consider this
file to load with COPY t FROM '/tmp/t.csv' WITH CSV
$ cat /tmp/t.csv
line 1
\.
line 3
line 4

It results in having only "line 1" being imported.

Best regards,
--
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-05-19 16:22:37 Re: The documentation for READ COMMITTED may be incomplete or wrong
Previous Message Stephen Frost 2023-05-19 15:54:12 Re: How to ensure that SSPI support (Windows) enabled?