]> granicus.if.org Git - postgresql/commitdiff
Regression tests for the COPY CSV header feature. From Andrew Dunstan.
authorNeil Conway <neilc@samurai.com>
Tue, 10 May 2005 00:16:07 +0000 (00:16 +0000)
committerNeil Conway <neilc@samurai.com>
Tue, 10 May 2005 00:16:07 +0000 (00:16 +0000)
src/test/regress/input/copy.source
src/test/regress/output/copy.source

index 184a0ec1bcf172e9f3d137dd10e532b73b05c14a..98dc272ce783e5c407ba1afaf1a2a4dd7a384ac5 100644 (file)
@@ -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;
 
index 35ef9dce7eaf9bde6f14fa45040ed10e447efea6..e6839d3f3640935170e692b58a7deb9586805b99 100644 (file)
@@ -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