aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2005-05-10 00:16:07 +0000
committerNeil Conway <neilc@samurai.com>2005-05-10 00:16:07 +0000
commit8c4da76cf3438fd80ce166681e62b617bb1a624c (patch)
tree28dd8ebe70b61143ed6757bf5fbf9f5b62890ef8
parent6080da501c3d02d00e0bce9a9b49831a98c3dd6a (diff)
downloadpostgresql-8c4da76cf3438fd80ce166681e62b617bb1a624c.tar.gz
postgresql-8c4da76cf3438fd80ce166681e62b617bb1a624c.zip
Regression tests for the COPY CSV header feature. From Andrew Dunstan.
-rw-r--r--src/test/regress/input/copy.source14
-rw-r--r--src/test/regress/output/copy.source10
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source
index 184a0ec1bcf..98dc272ce78 100644
--- a/src/test/regress/input/copy.source
+++ b/src/test/regress/input/copy.source
@@ -86,4 +86,18 @@ copy copytest2 from '@abs_builddir@/results/copytest.csv' csv quote '\'' escape
select * from copytest except select * from copytest2;
+-- test header line feature
+
+create temp table copytest3 (
+ c1 int,
+ "col with , comma" text,
+ "col with "" quote" int);
+
+copy copytest3 from stdin csv header;
+this is just a line full of junk that would error out if parsed
+1,a,1
+2,b,2
+\.
+
+copy copytest3 to stdout csv header;
diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source
index 35ef9dce7ea..e6839d3f364 100644
--- a/src/test/regress/output/copy.source
+++ b/src/test/regress/output/copy.source
@@ -58,3 +58,13 @@ select * from copytest except select * from copytest2;
-------+------+--------
(0 rows)
+-- test header line feature
+create temp table copytest3 (
+ c1 int,
+ "col with , comma" text,
+ "col with "" quote" int);
+copy copytest3 from stdin csv header;
+copy copytest3 to stdout csv header;
+c1,"col with , comma","col with "" quote"
+1,a,1
+2,b,2