Re: Fixing backslash dot for COPY FROM...CSV
Daniel Verite <daniel@manitou-mail.org>
From: "Daniel Verite" <daniel@manitou-mail.org>
To: "Sutou Kouhei" <kou@clear-code.com>
Cc: tgl@sss.pgh.pa.us,
bruce@momjian.us,
robertmhaas@gmail.com,
pgsql-hackers@postgresql.org
Date: 2024-07-31T13:42:41Z
Lists: pgsql-hackers
Attachments
- v5-0001-Support-backslash-dot-on-a-line-by-itself-as-vali.patch (text/plain) patch v5-0001
- test-copy-combinations.sh (application/octet-stream)
- copy-test-results.txt (text/plain)
Sutou Kouhei wrote: > BTW, here is a diff after pgindent: PFA a v5 with the cosmetic changes applied. > I also confirmed that the updated server and non-updated > psql compatibility problem (the end-of-data "\." is > inserted). It seems that it's difficult to solve without > introducing incompatibility. To clarify the compatibility issue, the attached bash script compares pre-patch and post-patch client/server combinations with different cases, submitted with different copy variants. case A: quoted backslash-dot sequence in CSV case B: unquoted backslash-dot sequence in CSV case C: CSV without backslash-dot case D: text with backslash-dot at the end case E: text without backslash-dot at the end The different ways to submit the data: copy from file \copy from file \copy from pstdin copy from stdin with embedded data after the command Also attaching the tables of results with the patch as it stands. "Failed" is when psql reports an error and "Data mismatch" is when it succeeds but with copied data differing from what was expected. Does your test has an equivalent in these results or is it a different case? 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