Instead of the brittle csv we used to use, use postgresql text mode to transfer
data in the copy operation.
To check that this change makes sense, add test coverage for bytea[], bytea[][]
and timestamptz.
Differential D3394
Improve test coverage and type coverage for copy_to olasd on Jul 2 2020, 1:32 PM. Authored by Tags None Subscribers None
Details Instead of the brittle csv we used to use, use postgresql text mode to transfer To check that this change makes sense, add test coverage for bytea[], bytea[][] tox tests extended
Diff Detail
Event TimelineComment Actions Build is green Patch application report for D3394 (id=12037)Rebasing onto 3a612cca29... Current branch diff-target is up to date. Changes applied before testcommit 89211fbd61a49a488555f770c3e503e7e9d6fdce Author: Nicolas Dandrimont <nicolas@dandrimont.eu> Date: Thu Jul 2 13:30:33 2020 +0200 Improve test coverage and type coverage for copy_to Instead of the brittle csv we used to use, use postgresql text mode to transfer data in the `copy` operation. To check that this change makes sense, add test coverage for bytea[], bytea[][] and timestamptz. See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/15/ for more details. Comment Actions Looks globally fine to me, but I have a few comments/requests. Also, not sure I can "see" that every path in escape() is actually tested here. Maybe via the strategies? Are there edge cases that need attention? (like "patterns" (e.g. \N), embedded in string or bytes, or so; more or less any combination of calls to escape being used as raw input data, typically).
Comment Actions Reimplement copy_to escaping from the ground up.
Comment Actions Build is green Patch application report for D3394 (id=12048)Rebasing onto 3a612cca29... Current branch diff-target is up to date. Changes applied before testcommit 7124063e497a30b181b7b85dae4b61f9e4fe5120 Author: Nicolas Dandrimont <nicolas@dandrimont.eu> Date: Thu Jul 2 13:30:33 2020 +0200 Reimplement PostgreSQL COPY escaping from first principles Instead of the brittle csv we used to use, use postgresql text mode to transfer data in the `copy` operation. Reference all relevant bits of the PostgreSQL documentation inline with the code. This also adds test coverage for most supported types, as well as making sure all escaping corner cases are covered. See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/16/ for more details. |