Skip to content

Commit 8c4da76

Browse files
author
Neil Conway
committed
Regression tests for the COPY CSV header feature. From Andrew Dunstan.
1 parent 6080da5 commit 8c4da76

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/test/regress/input/copy.source

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,18 @@ copy copytest2 from '@abs_builddir@/results/copytest.csv' csv quote '\'' escape
8686
select * from copytest except select * from copytest2;
8787

8888

89+
-- test header line feature
90+
91+
create temp table copytest3 (
92+
c1 int,
93+
"col with , comma" text,
94+
"col with "" quote" int);
95+
96+
copy copytest3 from stdin csv header;
97+
this is just a line full of junk that would error out if parsed
98+
1,a,1
99+
2,b,2
100+
\.
101+
102+
copy copytest3 to stdout csv header;
89103

src/test/regress/output/copy.source

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,13 @@ select * from copytest except select * from copytest2;
5858
-------+------+--------
5959
(0 rows)
6060

61+
-- test header line feature
62+
create temp table copytest3 (
63+
c1 int,
64+
"col with , comma" text,
65+
"col with "" quote" int);
66+
copy copytest3 from stdin csv header;
67+
copy copytest3 to stdout csv header;
68+
c1,"col with , comma","col with "" quote"
69+
1,a,1
70+
2,b,2

0 commit comments

Comments
 (0)