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 No error : Update without key in safe mode but with LIMIT
41 DELETE FROM t1 LIMIT 2;
42 SELECT * FROM t1;
43 a b
44 3 val3
45 4 val4
46 5 val5
47 6 val6
48 7 val7
49 8 val8
50 9 val9
51 '#-----------------------------FN_DYNVARS_164_04------------------------------------#'
52 Expected error : Update without key in safe mode
53 DELETE FROM t1 WHERE b='val1';
54 ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.
55 SELECT * FROM t1;
56 a b
57 3 val3
58 4 val4
59 5 val5
60 6 val6
61 7 val7
62 8 val8
63 9 val9
64 '#-----------------------------FN_DYNVARS_164_05------------------------------------#'
65 This one should work
66 DELETE FROM t1 WHERE a=3;
67 SELECT * FROM t1;
68 a b
69 4 val4
70 5 val5
71 6 val6
72 7 val7
73 8 val8
74 9 val9
75
76 Value OFF
77
78 SET SESSION sql_safe_updates = OFF;
79 '#-----------------------------FN_DYNVARS_164_06------------------------------------#'
80 This one should work
81 DELETE FROM t1 WHERE b='val1';
82 SELECT * FROM t1;
83 a b
84 4 val4
85 5 val5
86 6 val6
87 7 val7
88 8 val8
89 9 val9
90 '#-----------------------------FN_DYNVARS_164_07------------------------------------#'
91 This one should work
92 DELETE FROM t1 WHERE a=5;
93 SELECT * FROM t1;
94 a b
95 4 val4
96 6 val6
97 7 val7
98 8 val8
99 9 val9
100 '#-----------------------------FN_DYNVARS_164_08------------------------------------#'
101 This one should work
102 DELETE FROM t1 LIMIT 2;
103 SELECT * FROM t1;
104 a b
105 7 val7
106 8 val8
107 9 val9
108 '#-----------------------------FN_DYNVARS_164_09------------------------------------#'
109 This one should work
110 DELETE FROM t1;
111 Bug#35392 Unexpected error occurs in this statement Can't change size of the file
112 statement is remarked because the error is uncatchable by testing framework
113 SELECT * FROM t1;
114 a b
115 7 val7
116 8 val8
117 9 val9
118 PREPARE stmt FROM 'DELETE FROM t1;';
119 Expected error : Update without key in safe mode
120 Bug#35392 Unexpected error occurs in this statement Can't change size of the file
121 statement is remarked because the error is uncatchable by testing framework
122 DEALLOCATE PREPARE stmt;
123 '#----------------------------FN_DYNVARS_164_10--------------------------------------#'
124 ** Connecting con_int1 using root **
125 ** Connection con_int1 **
126 SELECT @@SESSION.sql_safe_updates;
127 @@SESSION.sql_safe_updates
128 0
129 0 / FALSE Expected
130 SET SESSION sql_safe_updates = FALSE;
131 ** Connecting con_int2 using root **
132 ** Connection con_int2 **
133 SELECT @@SESSION.sql_safe_updates;
134 @@SESSION.sql_safe_updates
135 0
136 0 / FALSE Expected
137 SET SESSION sql_safe_updates = TRUE;
138 ** Connection con_int2 **
139 SELECT @@SESSION.sql_safe_updates;
140 @@SESSION.sql_safe_updates
141 1
142 1 / TRUE Expected
143 ** Connection con_int1 **
144 SELECT @@SESSION.sql_safe_updates;
145 @@SESSION.sql_safe_updates
146 0
147 0 / FALSE Expected
148 ** Connection default **
149 Disconnecting Connections con_int1, con_int2
150 SET SESSION sql_safe_updates = @default_sql_safe_updates;
151 DROP TABLE t1;