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-22 16:12:53
Message-ID: 31677c7c-097f-490c-9527-80f9a4bbfabb@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joel Jacobson wrote:

> Is there a valid reason why \. is needed for COPY FROM filename?
> It seems to me it would only be necessary for the COPY FROM STDIN case,
> since files have a natural end-of-file and a known file size.

Looking at CopyReadLineText() over at [1], I don't see a reason why
the unquoted \. could not be handled with COPY FROM file.
Even COPY FROM STDIN looks like it could be benefit, so that
\copy from file csv would hopefully not choke or truncate the data.
There's still the case when the CSV data is embedded in a psql script
(psql is unable to know where it ends), but for that, "don't do that"
might be a reasonable answer.

[1]
https://doxygen.postgresql.org/copyfromparse_8c.html#a90201f711221dd82d0c08deedd91e1b3

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 Nikita Malakhov 2023-05-22 16:13:21 Re: RFI: Extending the TOAST Pointer
Previous Message reid.thompson 2023-05-22 15:59:56 Re: Add the ability to limit the amount of memory that can be allocated to backends.