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

From: Kirk Wolak <wolakk(at)gmail(dot)com>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: Joel Jacobson <joel(at)compiler(dot)org>, 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:31:43
Message-ID: CACLU5mRj48yYnEj7k3xYFbsNkgG5NsZO7NxQQLM03G9HHQYuqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 22, 2023 at 12:13 PM Daniel Verite <daniel(at)manitou-mail(dot)org>
wrote:

> 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.
>

Don't have what looks like a pg_dump script?
We specifically create such SQL files with embedded data. Depending on the
circumstances,
we either confirm that indexes dropped and triggers are disabled... [Or we
create a dynamic name,
and insert it into a queue table for later processing], and then we COPY
the data, ending in
\.

We do NOT do "CSV", we mimic pg_dump.

Now, if you are talking about only impacting a fixed data file format...
Sure. But impacting how psql
processes these \i included files... (that could hurt)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-05-22 17:08:17 Re: Order changes in PG16 since ICU introduction
Previous Message Peter Geoghegan 2023-05-22 16:22:53 Re: Avoiding another needless ERROR during nbtree page deletion