forked from pganalyze/libpg_query
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08_avoid_zero_length_delimiter_in_regression_tests.patch
109 lines (103 loc) · 4.05 KB
/
08_avoid_zero_length_delimiter_in_regression_tests.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
commit 48cc023e889e02f8f172c5130a6f958c92da3ddf
Author: Lukas Fittl <[email protected]>
Date: Sat Feb 20 04:38:04 2021 -0800
Avoid zero-length delimiter in regression test files
This is a pg_query-specific patch that ensures we can use the split
function on the regression test files. Zero-length delimiters fail
at the scanner level in Postgres, and thus need to be removed.
diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out
index faf1a4d1b0..fb428c11b6 100644
--- a/src/test/regress/expected/copy2.out
+++ b/src/test/regress/expected/copy2.out
@@ -488,9 +488,9 @@ BEGIN;
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(b), FORCE_NULL(c));
COMMIT;
SELECT b, c FROM forcetest WHERE a = 1;
- b | c
----+------
- | NULL
+ b | c
+---+----------
+ | notempty
(1 row)
-- should succeed, FORCE_NULL and FORCE_NOT_NULL can be both specified
@@ -498,17 +498,17 @@ BEGIN;
COPY forcetest (a, b, c, d) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(c,d), FORCE_NULL(c,d));
COMMIT;
SELECT c, d FROM forcetest WHERE a = 2;
- c | d
----+------
- | NULL
+ c | d
+---+----------
+ | notempty
(1 row)
-- should fail with not-null constraint violation
BEGIN;
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NULL(b), FORCE_NOT_NULL(c));
ERROR: null value in column "b" of relation "forcetest" violates not-null constraint
-DETAIL: Failing row contains (3, null, , null, null).
-CONTEXT: COPY forcetest, line 1: "3,,"""
+DETAIL: Failing row contains (3, null, notempty, null, null).
+CONTEXT: COPY forcetest, line 1: "3,,"notempty""
ROLLBACK;
-- should fail with "not referenced by COPY" error
BEGIN;
diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out
index b50293d514..e1704ff9f4 100644
--- a/src/test/regress/expected/create_am.out
+++ b/src/test/regress/expected/create_am.out
@@ -368,10 +368,8 @@ ORDER BY 3, 1, 2;
ROLLBACK;
-- Third, check that we can neither create a table using a nonexistent
-- AM, nor using an index AM
-CREATE TABLE i_am_a_failure() USING "";
-ERROR: zero-length delimited identifier at or near """"
-LINE 1: CREATE TABLE i_am_a_failure() USING "";
- ^
+CREATE TABLE i_am_a_failure() USING "notempty";
+ERROR: access method "notempty" does not exist
CREATE TABLE i_am_a_failure() USING i_do_not_exist_am;
ERROR: access method "i_do_not_exist_am" does not exist
CREATE TABLE i_am_a_failure() USING "I do not exist AM";
diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql
index d759635068..dce61becbd 100644
--- a/src/test/regress/sql/copy2.sql
+++ b/src/test/regress/sql/copy2.sql
@@ -319,21 +319,21 @@ CREATE TEMP TABLE forcetest (
-- should succeed with no effect ("b" remains an empty string, "c" remains NULL)
BEGIN;
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(b), FORCE_NULL(c));
-1,,""
+1,,"notempty"
\.
COMMIT;
SELECT b, c FROM forcetest WHERE a = 1;
-- should succeed, FORCE_NULL and FORCE_NOT_NULL can be both specified
BEGIN;
COPY forcetest (a, b, c, d) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(c,d), FORCE_NULL(c,d));
-2,'a',,""
+2,'a',,"notempty"
\.
COMMIT;
SELECT c, d FROM forcetest WHERE a = 2;
-- should fail with not-null constraint violation
BEGIN;
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NULL(b), FORCE_NOT_NULL(c));
-3,,""
+3,,"notempty"
\.
ROLLBACK;
-- should fail with "not referenced by COPY" error
diff --git a/src/test/regress/sql/create_am.sql b/src/test/regress/sql/create_am.sql
index 2785ffd8bb..784fef31a4 100644
--- a/src/test/regress/sql/create_am.sql
+++ b/src/test/regress/sql/create_am.sql
@@ -248,7 +248,7 @@ ROLLBACK;
-- Third, check that we can neither create a table using a nonexistent
-- AM, nor using an index AM
-CREATE TABLE i_am_a_failure() USING "";
+CREATE TABLE i_am_a_failure() USING "notempty";
CREATE TABLE i_am_a_failure() USING i_do_not_exist_am;
CREATE TABLE i_am_a_failure() USING "I do not exist AM";
CREATE TABLE i_am_a_failure() USING "btree";