angusdev opened a new pull request, #265: URL: https://github.com/apache/commons-csv/pull/265
I tested in psql 14.5 Homebrew in Mac M1. CSVFormat.POSTGRESQL_CSV - special characters are not escaped. CSVFormat.POSTGRESQL_TEXT - values are not quoted. ```sql drop table COMMONS_CSV_PSQL_TEST; create table COMMONS_CSV_PSQL_TEST (ID INTEGER, COL1 VARCHAR, COL2 VARCHAR, COL3 VARCHAR, COL4 VARCHAR); insert into COMMONS_CSV_PSQL_TEST select 1, 'abc', 'test line 1' || chr(10) || 'test line 2', null, ''; insert into COMMONS_CSV_PSQL_TEST select 2, 'xyz', '\b:' || chr(8) || ' \n:' || chr(10) || ' \r:' || chr(13), 'a', 'b'; insert into COMMONS_CSV_PSQL_TEST values (3, 'a', 'b,c,d', '"quoted"', 'e'); copy COMMONS_CSV_PSQL_TEST TO '/tmp/psql.csv' WITH (FORMAT CSV); copy COMMONS_CSV_PSQL_TEST TO '/tmp/psql.tsv'; ``` ``` cat /tmp/psql.csv 1,abc,"test line 1 test line 2",,"" 2,xyz,"\b:^H \n: \r:^M",a,b 3,a,"b,c,d","""quoted""",e ``` ``` cat /tmp/psql.tsv 1 abc test line 1\ntest line 2 \N 2 xyz \\b:\b \\n:\n \\r:\r a b 3 a b,c,d "quoted" e ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
