-
Notifications
You must be signed in to change notification settings - Fork 397
Expand file tree
/
Copy pathTiDBErrors.java
More file actions
122 lines (100 loc) · 4.21 KB
/
TiDBErrors.java
File metadata and controls
122 lines (100 loc) · 4.21 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
package sqlancer.tidb;
import java.util.ArrayList;
import java.util.List;
import sqlancer.common.query.ExpectedErrors;
public final class TiDBErrors {
private TiDBErrors() {
}
public static List<String> getExpressionErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("DECIMAL value is out of range");
errors.add("error parsing regexp");
errors.add("BIGINT UNSIGNED value is out of range");
errors.add("Data truncation: Truncated incorrect time value");
errors.add("Data truncation: Incorrect time value");
errors.add("Data truncation: Incorrect datetime value");
errors.add("overflows double");
errors.add("overflows bigint");
errors.add("strconv.ParseFloat: parsing");
errors.add("in 'order clause'"); // int constants in order by clause
// functions
errors.add("BIGINT value is out of range");
errors.add("doesn't have a default value"); // default
errors.add("is not valid for CHARACTER SET");
errors.add("DOUBLE value is out of range");
errors.add("Result of space() was larger than max_allowed_packet");
errors.add("Data truncat");
errors.add("Truncated incorrect FLOAT value");
errors.add("Bad Number");
errors.add("strconv.Atoi: parsing");
errors.add("expected integer");
errors.add("Duplicate entry");
// regex
errors.add("error parsing regexp");
errors.add("from regexp");
errors.add("Empty pattern is invalid");
errors.add("Invalid regexp pattern");
// To avoid bugs
errors.add("Unknown column"); // https://github.com/pingcap/tidb/issues/35522
errors.add("Can\'t find column"); // https://github.com/pingcap/tidb/issues/35527
errors.add("Cannot convert"); // https://github.com/pingcap/tidb/issues/35652
if (TiDBBugs.bug35677) {
errors.add("for function inet_aton");
}
if (TiDBBugs.bug35522) {
errors.add("ERROR 1054 (42S22)");
}
if (TiDBBugs.bug35652) {
errors.add("from binary to utf8");
}
if (TiDBBugs.bug38295) {
errors.add("assertion failed");
}
if (TiDBBugs.bug44747) {
errors.add("index out of range");
}
return errors;
}
public static void addExpressionErrors(ExpectedErrors errors) {
errors.addAll(getExpressionErrors());
}
public static List<String> getExpressionHavingErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("is not in GROUP BY clause and contains nonaggregated column");
errors.add("Unknown column");
return errors;
}
public static void addExpressionHavingErrors(ExpectedErrors errors) {
errors.addAll(getExpressionHavingErrors());
}
public static List<String> getInsertErrors() {
ArrayList<String> errors = new ArrayList<>();
errors.add("Duplicate entry");
errors.add("cannot be null");
errors.add("doesn't have a default value");
errors.add("Out of range value");
errors.add("Incorrect double value");
errors.add("Incorrect float value");
errors.add("Incorrect int value");
errors.add("Incorrect tinyint value");
errors.add("Data truncation");
errors.add("Bad Number");
errors.add("The value specified for generated column"); // TODO: do not insert data into generated columns
errors.add("incorrect utf8 value");
errors.add("Data truncation: %s value is out of range in '%s'");
errors.add("Incorrect smallint value");
errors.add("Incorrect bigint value");
errors.add("Incorrect decimal value");
errors.add("error parsing regexp");
errors.add("is not valid for CHARACTER SET");
errors.add("for function inet_aton");
errors.add("'Empty pattern is invalid' from regexp");
errors.add("Data too long for expression index");
errors.add("Data too long for column");
errors.add("Data Too Long");
return errors;
}
public static void addInsertErrors(ExpectedErrors errors) {
errors.addAll(getInsertErrors());
}
}