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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
** Setup **
SET @default_sql_safe_updates = @@sql_safe_updates;
CREATE TEMPORARY TABLE t1(a int PRIMARY KEY, b varchar(20));
INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3');
INSERT INTO t1 VALUES(4, 'val4');
INSERT INTO t1 VALUES(5, 'val5');
INSERT INTO t1 VALUES(6, 'val6');
INSERT INTO t1 VALUES(7, 'val7');
INSERT INTO t1 VALUES(8, 'val8');
INSERT INTO t1 VALUES(9, 'val9');
'#-----------------------------FN_DYNVARS_164_01------------------------------------#'
Value ON
SET SESSION sql_safe_updates = ON;
'#-----------------------------FN_DYNVARS_164_02------------------------------------#'
Expected error : Update without key in safe mode
DELETE FROM t1;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
SELECT * FROM t1;
a b
1 val1
2 val2
3 val3
4 val4
5 val5
6 val6
7 val7
8 val8
9 val9
PREPARE stmt FROM 'DELETE FROM t1;';
Expected error : Update without key in safe mode
EXECUTE stmt;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
DEALLOCATE PREPARE stmt;
'#-----------------------------FN_DYNVARS_164_03------------------------------------#'
Expected error : Update without key in safe mode
DELETE FROM t1 LIMIT 2;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
SELECT * FROM t1;
a b
1 val1
2 val2
3 val3
4 val4
5 val5
6 val6
7 val7
8 val8
9 val9
'#-----------------------------FN_DYNVARS_164_04------------------------------------#'
Expected error : Update without key in safe mode
DELETE FROM t1 WHERE b='val1';
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
SELECT * FROM t1;
a b
1 val1
2 val2
3 val3
4 val4
5 val5
6 val6
7 val7
8 val8
9 val9
'#-----------------------------FN_DYNVARS_164_05------------------------------------#'
This one should work
DELETE FROM t1 WHERE a=1;
SELECT * FROM t1;
a b
2 val2
3 val3
4 val4
5 val5
6 val6
7 val7
8 val8
9 val9
Value OFF
SET SESSION sql_safe_updates = OFF;
'#-----------------------------FN_DYNVARS_164_06------------------------------------#'
This one should work
DELETE FROM t1 WHERE b='val1';
SELECT * FROM t1;
a b
2 val2
3 val3
4 val4
5 val5
6 val6
7 val7
8 val8
9 val9
'#-----------------------------FN_DYNVARS_164_07------------------------------------#'
This one should work
DELETE FROM t1 WHERE a=1;
SELECT * FROM t1;
a b
2 val2
3 val3
4 val4
5 val5
6 val6
7 val7
8 val8
9 val9
'#-----------------------------FN_DYNVARS_164_08------------------------------------#'
This one should work
DELETE FROM t1 LIMIT 2;
SELECT * FROM t1;
a b
4 val4
5 val5
6 val6
7 val7
8 val8
9 val9
'#-----------------------------FN_DYNVARS_164_09------------------------------------#'
This one should work
DELETE FROM t1;
Bug#35392 Unexpected error occurs in this statement Can't change size of the file
statement is remarked because the error is uncatchable by testing framework
SELECT * FROM t1;
a b
4 val4
5 val5
6 val6
7 val7
8 val8
9 val9
PREPARE stmt FROM 'DELETE FROM t1;';
Expected error : Update without key in safe mode
Bug#35392 Unexpected error occurs in this statement Can't change size of the file
statement is remarked because the error is uncatchable by testing framework
DEALLOCATE PREPARE stmt;
'#----------------------------FN_DYNVARS_164_10--------------------------------------#'
connect con_int1,localhost,root,,;
connection con_int1;
SELECT @@SESSION.sql_safe_updates;
@@SESSION.sql_safe_updates
0
0 / FALSE Expected
SET SESSION sql_safe_updates = FALSE;
connect con_int2,localhost,root,,;
connection con_int2;
SELECT @@SESSION.sql_safe_updates;
@@SESSION.sql_safe_updates
0
0 / FALSE Expected
SET SESSION sql_safe_updates = TRUE;
connection con_int2;
SELECT @@SESSION.sql_safe_updates;
@@SESSION.sql_safe_updates
1
1 / TRUE Expected
connection con_int1;
SELECT @@SESSION.sql_safe_updates;
@@SESSION.sql_safe_updates
0
0 / FALSE Expected
connection default;
disconnect con_int1;
disconnect con_int2;
SET SESSION sql_safe_updates = @default_sql_safe_updates;
DROP TABLE t1;
|