Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfb7d212

Browse files
committed
Add CVS \r\n regression tests.
Andrew Dunstan
1 parent888271e commitfb7d212

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

‎src/test/regress/input/copy.source

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,36 @@ COPY bt_txt_heap FROM '@abs_srcdir@/data/desc.data';
5454

5555
COPY bt_f8_heap FROM '@abs_srcdir@/data/hash.data';
5656

57+
--- test copying in CSV mode with various styles
58+
--- of embedded line ending characters
59+
60+
create temp table copytest (
61+
styletext,
62+
test text,
63+
fillerint);
64+
65+
insert into copytest values('DOS','abc\r\ndef',1);
66+
insert into copytest values('Unix','abc\ndef',2);
67+
insert into copytest values('Mac','abc\rdef',3);
68+
insert into copytest values('esc\\ape','a\\r\\\r\\\n\\nb',4);
69+
70+
copy copytest to '@abs_builddir@/results/copytest.csv' csv;
71+
72+
create temp table copytest2 (like copytest);
73+
74+
copy copytest2 from '@abs_builddir@/results/copytest.csv' csv;
75+
76+
select * from copytest except select * from copytest2;
77+
78+
truncate copytest2;
79+
80+
--- same test but with an escape char different from quote char
81+
82+
copy copytest to '@abs_builddir@/results/copytest.csv' csv quote '\'' escape '\\';
83+
84+
copy copytest2 from '@abs_builddir@/results/copytest.csv' csv quote '\'' escape '\\';
85+
86+
select * from copytest except select * from copytest2;
87+
88+
89+

‎src/test/regress/output/copy.source

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,30 @@ COPY bt_i4_heap FROM '@abs_srcdir@/data/desc.data';
3131
COPY bt_name_heap FROM '@abs_srcdir@/data/hash.data';
3232
COPY bt_txt_heap FROM '@abs_srcdir@/data/desc.data';
3333
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+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp