@@ -31,3 +31,30 @@ COPY bt_i4_heap FROM '@abs_srcdir@/data/desc.data';
31
31
COPY bt_name_heap FROM '@abs_srcdir@/data/hash.data';
32
32
COPY bt_txt_heap FROM '@abs_srcdir@/data/desc.data';
33
33
COPY bt_f8_heap FROM '@abs_srcdir@/data/hash.data';
34
+ --- test copying in CSV mode with various styles
35
+ --- of embedded line ending characters
36
+ create temp table copytest (
37
+ styletext,
38
+ test text,
39
+ fillerint);
40
+ insert into copytest values('DOS','abc\r\ndef',1);
41
+ insert into copytest values('Unix','abc\ndef',2);
42
+ insert into copytest values('Mac','abc\rdef',3);
43
+ insert into copytest values('esc\\ape','a\\r\\\r\\\n\\nb',4);
44
+ copy copytest to '@abs_builddir@/results/copytest.csv' csv;
45
+ create temp table copytest2 (like copytest);
46
+ copy copytest2 from '@abs_builddir@/results/copytest.csv' csv;
47
+ select * from copytest except select * from copytest2;
48
+ style | test | filler
49
+ -------+------+--------
50
+ (0 rows)
51
+
52
+ truncate copytest2;
53
+ --- same test but with an escape char different from quote char
54
+ copy copytest to '@abs_builddir@/results/copytest.csv' csv quote '\'' escape '\\';
55
+ copy copytest2 from '@abs_builddir@/results/copytest.csv' csv quote '\'' escape '\\';
56
+ select * from copytest except select * from copytest2;
57
+ style | test | filler
58
+ -------+------+--------
59
+ (0 rows)
60
+