Re: Fixing backslash dot for COPY FROM...CSV
Daniel Verite <daniel@manitou-mail.org>
From: "Daniel Verite" <daniel@manitou-mail.org>
To: "Artur Zakirov" <zaartur@gmail.com>
Cc: Sutou Kouhei <kou@clear-code.com>,
tgl@sss.pgh.pa.us,
bruce@momjian.us,
robertmhaas@gmail.com,
pgsql-hackers@postgresql.org
Date: 2024-09-30T19:15:44Z
Lists: pgsql-hackers
Attachments
- v6-0001-Support-backslash-dot-on-a-line-by-itself-as-vali.patch (text/plain) patch v6-0001
Artur Zakirov wrote: > I've tested the patch and it seems it works as expected. Thanks for looking at this! > It seems it isn't necessary to handle "\." within > "CopyAttributeOutCSV()" (file "src/backend/commands/copyto.c") > anymore. It's still useful to produce CSV data that can be safely reloaded by previous versions. Until these versions are EOL'ed, I assume we'd better continue to quote "\." > Another thing is that the comparison "copystream == > pset.cur_cmd_source" happens twice within "handleCopyIn()". TBH it is > a bit confusing to me what is the real purpose of that check, but one > of the comparisons looks unnecessary. Indeed, good catch. The redundant comparison is removed in the attached v6. Best regards, -- Daniel Vérité https://postgresql.verite.pro/ Twitter: @DanielVerite
Commits
-
Reject a copy EOF marker that has data ahead of it on the same line.
- da8a4c166647 18.0 landed
-
Do not treat \. as an EOF marker in CSV mode for COPY IN.
- 770233748981 18.0 landed
-
doc: \copy can get data values \. and end-of-input confused
- 42d3125adae1 17.0 cited