I have added some regression tests for COPY CSV format. I had promised
Andrew I would do this because he did pg_ctl in C. :-)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: src/test/regress/expected/copy2.out
===================================================================
RCS file: /cvsroot/pgsql-server/src/test/regress/expected/copy2.out,v
retrieving revision 1.17
diff -c -c -r1.17 copy2.out
*** src/test/regress/expected/copy2.out 10 Oct 2003 03:46:51 -0000 1.17
--- src/test/regress/expected/copy2.out 9 Jun 2004 23:35:15 -0000
***************
*** 172,177 ****
--- 172,196 ----
3 after trigger fired
4 after trigger fired
5 after trigger fired
+ CREATE TABLE y (
+ col1 text,
+ col2 text
+ );
+ INSERT INTO y VALUES ('Jackson, Sam', '\\h');
+ INSERT INTO y VALUES ('It is "perfect".','\t');
+ INSERT INTO y VALUES ('', NULL);
+ COPY y TO stdout WITH CSV;
+ "Jackson, Sam",\h
+ "It is ""perfect"".",
+ "",
+ COPY y TO stdout WITH CSV QUOTE '''' DELIMITER '|';
+ Jackson, Sam|\h
+ It is "perfect".|
+ ''|
+ COPY y TO stdout WITH CSV FORCE QUOTE col2 ESCAPE '\\';
+ "Jackson, Sam","\\h"
+ "It is \"perfect\"."," "
+ "",
DROP TABLE x;
DROP FUNCTION fn_x_before();
DROP FUNCTION fn_x_after();
Index: src/test/regress/sql/copy2.sql
===================================================================
RCS file: /cvsroot/pgsql-server/src/test/regress/sql/copy2.sql,v
retrieving revision 1.8
diff -c -c -r1.8 copy2.sql
*** src/test/regress/sql/copy2.sql 10 Oct 2003 03:46:51 -0000 1.8
--- src/test/regress/sql/copy2.sql 9 Jun 2004 23:35:15 -0000
***************
*** 116,121 ****
--- 116,134 ----
COPY x (c, e) TO stdout;
COPY x (b, e) TO stdout WITH NULL 'I''m null';
+ CREATE TABLE y (
+ col1 text,
+ col2 text
+ );
+
+ INSERT INTO y VALUES ('Jackson, Sam', '\\h');
+ INSERT INTO y VALUES ('It is "perfect".','\t');
+ INSERT INTO y VALUES ('', NULL);
+
+ COPY y TO stdout WITH CSV;
+ COPY y TO stdout WITH CSV QUOTE '''' DELIMITER '|';
+ COPY y TO stdout WITH CSV FORCE QUOTE col2 ESCAPE '\\';
+
DROP TABLE x;
DROP FUNCTION fn_x_before();
DROP FUNCTION fn_x_after();