Debian Codegraph @

mysql-test/suite/sys_vars/r/sql_safe_updates_func.result

raw
1 ** Setup **
2
3 SET @default_sql_safe_updates = @@sql_safe_updates;
4 CREATE TEMPORARY TABLE t1(a int PRIMARY KEY, b varchar(20));
5 INSERT INTO t1 VALUES(1, 'val1');
6 INSERT INTO t1 VALUES(2, 'val2');
7 INSERT INTO t1 VALUES(3, 'val3');
8 INSERT INTO t1 VALUES(4, 'val4');
9 INSERT INTO t1 VALUES(5, 'val5');
10 INSERT INTO t1 VALUES(6, 'val6');
11 INSERT INTO t1 VALUES(7, 'val7');
12 INSERT INTO t1 VALUES(8, 'val8');
13 INSERT INTO t1 VALUES(9, 'val9');
14 '#-----------------------------FN_DYNVARS_164_01------------------------------------#'
15
16 Value ON
17
18 SET SESSION sql_safe_updates = ON;
19 '#-----------------------------FN_DYNVARS_164_02------------------------------------#'
20 Expected error : Update without key in safe mode
21 DELETE FROM t1;
22 ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
23 SELECT * FROM t1;
24 a b
25 1 val1
26 2 val2
27 3 val3
28 4 val4
29 5 val5
30 6 val6
31 7 val7
32 8 val8
33 9 val9
34 PREPARE stmt FROM 'DELETE FROM t1;';
35 Expected error : Update without key in safe mode
36 EXECUTE stmt;
37 ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
38 DEALLOCATE PREPARE stmt;
39 '#-----------------------------FN_DYNVARS_164_03------------------------------------#'
40 Expected error : Update without key in safe mode
41 DELETE FROM t1 LIMIT 2;
42 ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
43 SELECT * FROM t1;
44 a b
45 1 val1
46 2 val2
47 3 val3
48 4 val4
49 5 val5
50 6 val6
51 7 val7
52 8 val8
53 9 val9
54 '#-----------------------------FN_DYNVARS_164_04------------------------------------#'
55 Expected error : Update without key in safe mode
56 DELETE FROM t1 WHERE b='val1';
57 ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
58 SELECT * FROM t1;
59 a b
60 1 val1
61 2 val2
62 3 val3
63 4 val4
64 5 val5
65 6 val6
66 7 val7
67 8 val8
68 9 val9
69 '#-----------------------------FN_DYNVARS_164_05------------------------------------#'
70 This one should work
71 DELETE FROM t1 WHERE a=1;
72 SELECT * FROM t1;
73 a b
74 2 val2
75 3 val3
76 4 val4
77 5 val5
78 6 val6
79 7 val7
80 8 val8
81 9 val9
82
83 Value OFF
84
85 SET SESSION sql_safe_updates = OFF;
86 '#-----------------------------FN_DYNVARS_164_06------------------------------------#'
87 This one should work
88 DELETE FROM t1 WHERE b='val1';
89 SELECT * FROM t1;
90 a b
91 2 val2
92 3 val3
93 4 val4
94 5 val5
95 6 val6
96 7 val7
97 8 val8
98 9 val9
99 '#-----------------------------FN_DYNVARS_164_07------------------------------------#'
100 This one should work
101 DELETE FROM t1 WHERE a=1;
102 SELECT * FROM t1;
103 a b
104 2 val2
105 3 val3
106 4 val4
107 5 val5
108 6 val6
109 7 val7
110 8 val8
111 9 val9
112 '#-----------------------------FN_DYNVARS_164_08------------------------------------#'
113 This one should work
114 DELETE FROM t1 LIMIT 2;
115 SELECT * FROM t1;
116 a b
117 4 val4
118 5 val5
119 6 val6
120 7 val7
121 8 val8
122 9 val9
123 '#-----------------------------FN_DYNVARS_164_09------------------------------------#'
124 This one should work
125 DELETE FROM t1;
126 Bug#35392 Unexpected error occurs in this statement Can't change size of the file
127 statement is remarked because the error is uncatchable by testing framework
128 SELECT * FROM t1;
129 a b
130 4 val4
131 5 val5
132 6 val6
133 7 val7
134 8 val8
135 9 val9
136 PREPARE stmt FROM 'DELETE FROM t1;';
137 Expected error : Update without key in safe mode
138 Bug#35392 Unexpected error occurs in this statement Can't change size of the file
139 statement is remarked because the error is uncatchable by testing framework
140 DEALLOCATE PREPARE stmt;
141 '#----------------------------FN_DYNVARS_164_10--------------------------------------#'
142 connect con_int1,localhost,root,,;
143 connection con_int1;
144 SELECT @@SESSION.sql_safe_updates;
145 @@SESSION.sql_safe_updates
146 0
147 0 / FALSE Expected
148 SET SESSION sql_safe_updates = FALSE;
149 connect con_int2,localhost,root,,;
150 connection con_int2;
151 SELECT @@SESSION.sql_safe_updates;
152 @@SESSION.sql_safe_updates
153 0
154 0 / FALSE Expected
155 SET SESSION sql_safe_updates = TRUE;
156 connection con_int2;
157 SELECT @@SESSION.sql_safe_updates;
158 @@SESSION.sql_safe_updates
159 1
160 1 / TRUE Expected
161 connection con_int1;
162 SELECT @@SESSION.sql_safe_updates;
163 @@SESSION.sql_safe_updates
164 0
165 0 / FALSE Expected
166 connection default;
167 disconnect con_int1;
168 disconnect con_int2;
169 SET SESSION sql_safe_updates = @default_sql_safe_updates;
170 DROP TABLE t1;