Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 03bf0d9

Browse files
committed
Rewrite some regression queries for option checks with COPY
Some queries in copy2 are there to check various option combinations, and used "stdin" or "stdout" incompatible with the COPY TO or FROM clauses combined with them, which was confusing. This commit rewrites these queries to use a compatible grammar. The coverage of the tests is unchanged. Like the original commit 451d116, backpatch down to 16 where these have been introduced. A follow-up commit will rely on this area of the tests for a bug fix. Author: Joel Jacobson Reviewed-by: Zhang Mingli Discussion: https://postgr.es/m/65030d1d-5f90-4fa4-92eb-f5f50389858e@app.fastmail.com Backpatch-through: 16
1 parent c0490b0 commit 03bf0d9

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/test/regress/expected/copy2.out

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,36 +86,36 @@ ERROR: conflicting or redundant options
8686
LINE 1: COPY x from stdin (log_verbosity default, log_verbosity verb...
8787
^
8888
-- incorrect options
89-
COPY x to stdin (format BINARY, delimiter ',');
89+
COPY x from stdin (format BINARY, delimiter ',');
9090
ERROR: cannot specify DELIMITER in BINARY mode
91-
COPY x to stdin (format BINARY, null 'x');
91+
COPY x from stdin (format BINARY, null 'x');
9292
ERROR: cannot specify NULL in BINARY mode
9393
COPY x from stdin (format BINARY, on_error ignore);
9494
ERROR: only ON_ERROR STOP is allowed in BINARY mode
9595
COPY x from stdin (on_error unsupported);
9696
ERROR: COPY ON_ERROR "unsupported" not recognized
9797
LINE 1: COPY x from stdin (on_error unsupported);
9898
^
99-
COPY x to stdin (format TEXT, force_quote(a));
99+
COPY x from stdin (format TEXT, force_quote(a));
100100
ERROR: COPY FORCE_QUOTE requires CSV mode
101101
COPY x from stdin (format CSV, force_quote(a));
102102
ERROR: COPY FORCE_QUOTE cannot be used with COPY FROM
103-
COPY x to stdout (format TEXT, force_not_null(a));
103+
COPY x from stdin (format TEXT, force_not_null(a));
104104
ERROR: COPY FORCE_NOT_NULL requires CSV mode
105-
COPY x to stdin (format CSV, force_not_null(a));
105+
COPY x to stdout (format CSV, force_not_null(a));
106106
ERROR: COPY FORCE_NOT_NULL cannot be used with COPY TO
107-
COPY x to stdout (format TEXT, force_null(a));
107+
COPY x from stdin (format TEXT, force_null(a));
108108
ERROR: COPY FORCE_NULL requires CSV mode
109-
COPY x to stdin (format CSV, force_null(a));
109+
COPY x to stdout (format CSV, force_null(a));
110110
ERROR: COPY FORCE_NULL cannot be used with COPY TO
111-
COPY x to stdin (format BINARY, on_error unsupported);
111+
COPY x to stdout (format BINARY, on_error unsupported);
112112
ERROR: COPY ON_ERROR cannot be used with COPY TO
113-
LINE 1: COPY x to stdin (format BINARY, on_error unsupported);
114-
^
115-
COPY x to stdout (log_verbosity unsupported);
113+
LINE 1: COPY x to stdout (format BINARY, on_error unsupported);
114+
^
115+
COPY x from stdin (log_verbosity unsupported);
116116
ERROR: COPY LOG_VERBOSITY "unsupported" not recognized
117-
LINE 1: COPY x to stdout (log_verbosity unsupported);
118-
^
117+
LINE 1: COPY x from stdin (log_verbosity unsupported);
118+
^
119119
COPY x from stdin with (reject_limit 1);
120120
ERROR: COPY REJECT_LIMIT requires ON_ERROR to be set to IGNORE
121121
COPY x from stdin with (on_error ignore, reject_limit 0);

src/test/regress/sql/copy2.sql

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ COPY x from stdin (on_error ignore, on_error ignore);
7070
COPY x from stdin (log_verbosity default, log_verbosity verbose);
7171

7272
-- incorrect options
73-
COPY x to stdin (format BINARY, delimiter ',');
74-
COPY x to stdin (format BINARY, null 'x');
73+
COPY x from stdin (format BINARY, delimiter ',');
74+
COPY x from stdin (format BINARY, null 'x');
7575
COPY x from stdin (format BINARY, on_error ignore);
7676
COPY x from stdin (on_error unsupported);
77-
COPY x to stdin (format TEXT, force_quote(a));
77+
COPY x from stdin (format TEXT, force_quote(a));
7878
COPY x from stdin (format CSV, force_quote(a));
79-
COPY x to stdout (format TEXT, force_not_null(a));
80-
COPY x to stdin (format CSV, force_not_null(a));
81-
COPY x to stdout (format TEXT, force_null(a));
82-
COPY x to stdin (format CSV, force_null(a));
83-
COPY x to stdin (format BINARY, on_error unsupported);
84-
COPY x to stdout (log_verbosity unsupported);
79+
COPY x from stdin (format TEXT, force_not_null(a));
80+
COPY x to stdout (format CSV, force_not_null(a));
81+
COPY x from stdin (format TEXT, force_null(a));
82+
COPY x to stdout (format CSV, force_null(a));
83+
COPY x to stdout (format BINARY, on_error unsupported);
84+
COPY x from stdin (log_verbosity unsupported);
8585
COPY x from stdin with (reject_limit 1);
8686
COPY x from stdin with (on_error ignore, reject_limit 0);
8787

0 commit comments

Comments
 (0)