diff options
author | Bruce Momjian <bruce@momjian.us> | 2004-06-09 23:39:24 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2004-06-09 23:39:24 +0000 |
commit | 659660c116bb839483f9f0dabc24250ba6072df8 (patch) | |
tree | 47f6350bbc3a9b559ea962fb356b9d363997c86f | |
parent | 337f802460cf51c4d7a6628a263bea7789e57e11 (diff) | |
download | postgresql-659660c116bb839483f9f0dabc24250ba6072df8.tar.gz |
Add regression tests for CSV COPY format.
-rw-r--r-- | src/test/regress/expected/copy2.out | 19 | ||||
-rw-r--r-- | src/test/regress/sql/copy2.sql | 13 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index 6345969a03..6048f9392f 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -172,6 +172,25 @@ I'm null before trigger fired 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(); diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql index 52d8f563e3..35c376d1e3 100644 --- a/src/test/regress/sql/copy2.sql +++ b/src/test/regress/sql/copy2.sql @@ -116,6 +116,19 @@ COPY x TO stdout; 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(); |