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

Commit659660c

Browse files
committed
Add regression tests for CSV COPY format.
1 parent337f802 commit659660c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

‎src/test/regress/expected/copy2.out

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,25 @@ I'm nullbefore trigger fired
172172
3after trigger fired
173173
4after trigger fired
174174
5after trigger fired
175+
CREATE TABLE y (
176+
col1 text,
177+
col2 text
178+
);
179+
INSERT INTO y VALUES ('Jackson, Sam', '\\h');
180+
INSERT INTO y VALUES ('It is "perfect".','\t');
181+
INSERT INTO y VALUES ('', NULL);
182+
COPY y TO stdout WITH CSV;
183+
"Jackson, Sam",\h
184+
"It is ""perfect"".",
185+
"",
186+
COPY y TO stdout WITH CSV QUOTE '''' DELIMITER '|';
187+
Jackson, Sam|\h
188+
It is "perfect".|
189+
''|
190+
COPY y TO stdout WITH CSV FORCE QUOTE col2 ESCAPE '\\';
191+
"Jackson, Sam","\\h"
192+
"It is \"perfect\".",""
193+
"",
175194
DROP TABLE x;
176195
DROP FUNCTION fn_x_before();
177196
DROP FUNCTION fn_x_after();

‎src/test/regress/sql/copy2.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,19 @@ COPY x TO stdout;
116116
COPY x (c, e) TO stdout;
117117
COPY x (b, e) TO stdout WITHNULL'I''m null';
118118

119+
CREATETABLEy (
120+
col1text,
121+
col2text
122+
);
123+
124+
INSERT INTO yVALUES ('Jackson, Sam','\\h');
125+
INSERT INTO yVALUES ('It is "perfect".','\t');
126+
INSERT INTO yVALUES ('',NULL);
127+
128+
COPY y TO stdout WITH CSV;
129+
COPY y TO stdout WITH CSV QUOTE'''' DELIMITER'|';
130+
COPY y TO stdout WITH CSV FORCE QUOTE col2 ESCAPE'\\';
131+
119132
DROPTABLE x;
120133
DROPFUNCTION fn_x_before();
121134
DROPFUNCTION fn_x_after();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp