Skip to content
Snippets Groups Projects
Commit 659660c1 authored by Bruce Momjian's avatar Bruce Momjian
Browse files

Add regression tests for CSV COPY format.

parent 337f8024
No related branches found
No related tags found
No related merge requests found
...@@ -172,6 +172,25 @@ I'm null before trigger fired ...@@ -172,6 +172,25 @@ I'm null before trigger fired
3 after trigger fired 3 after trigger fired
4 after trigger fired 4 after trigger fired
5 after trigger fired 5 after trigger fired
CREATE TABLE y (
col1 text,
col2 text
);
INSERT INTO y VALUES ('Jackson, Sam', '\\h');
INSERT INTO y VALUES ('It is "perfect".','\t');
INSERT INTO y VALUES ('', NULL);
COPY y TO stdout WITH CSV;
"Jackson, Sam",\h
"It is ""perfect"".",
"",
COPY y TO stdout WITH CSV QUOTE '''' DELIMITER '|';
Jackson, Sam|\h
It is "perfect".|
''|
COPY y TO stdout WITH CSV FORCE QUOTE col2 ESCAPE '\\';
"Jackson, Sam","\\h"
"It is \"perfect\"."," "
"",
DROP TABLE x; DROP TABLE x;
DROP FUNCTION fn_x_before(); DROP FUNCTION fn_x_before();
DROP FUNCTION fn_x_after(); DROP FUNCTION fn_x_after();
...@@ -116,6 +116,19 @@ COPY x TO stdout; ...@@ -116,6 +116,19 @@ COPY x TO stdout;
COPY x (c, e) TO stdout; COPY x (c, e) TO stdout;
COPY x (b, e) TO stdout WITH NULL 'I''m null'; COPY x (b, e) TO stdout WITH NULL 'I''m null';
CREATE TABLE y (
col1 text,
col2 text
);
INSERT INTO y VALUES ('Jackson, Sam', '\\h');
INSERT INTO y VALUES ('It is "perfect".','\t');
INSERT INTO y VALUES ('', NULL);
COPY y TO stdout WITH CSV;
COPY y TO stdout WITH CSV QUOTE '''' DELIMITER '|';
COPY y TO stdout WITH CSV FORCE QUOTE col2 ESCAPE '\\';
DROP TABLE x; DROP TABLE x;
DROP FUNCTION fn_x_before(); DROP FUNCTION fn_x_before();
DROP FUNCTION fn_x_after(); DROP FUNCTION fn_x_after();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment