From b7a9d4084e1c0225886de8e3dbee58178e0639b0 Mon Sep 17 00:00:00 2001 From: Angus Date: Sun, 25 Sep 2022 22:48:54 +0100 Subject: [PATCH 1/3] CSV-290 - Fix the wrong assumptions in PostgreSQL formats CSVFormat.POSTGRESQL_CSV - special characters are not escaped. CSVFormat.POSTGRESQL_TEXT - values are not quoted. --- .../org/apache/commons/csv/CSVFormat.java | 14 +-- .../org/apache/commons/csv/CSVFormatTest.java | 8 +- .../commons/csv/issues/JiraCsv290Test.java | 117 ++++++++++++++++++ .../org/apache/commons/csv/CSV-290/psql.csv | 5 + .../org/apache/commons/csv/CSV-290/psql.tsv | 3 + 5 files changed, 136 insertions(+), 11 deletions(-) create mode 100644 src/test/java/org/apache/commons/csv/issues/JiraCsv290Test.java create mode 100644 src/test/resources/org/apache/commons/csv/CSV-290/psql.csv create mode 100644 src/test/resources/org/apache/commons/csv/CSV-290/psql.tsv diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java index ba39b742..27d2f08e 100644 --- a/src/main/java/org/apache/commons/csv/CSVFormat.java +++ b/src/main/java/org/apache/commons/csv/CSVFormat.java @@ -1047,7 +1047,7 @@ public final class CSVFormat implements Serializable { * *

* This is a comma-delimited format with a LF character as the line separator. Values are double quoted and special - * characters are escaped with {@code '"'}. The default NULL string is {@code ""}. + * characters are not escaped. The default NULL string is {@code ""}. *

* *

@@ -1055,7 +1055,7 @@ public final class CSVFormat implements Serializable { *

*