| 1 |
USE test; |
| 2 |
drop table if exists tb3; |
| 3 |
create table tb3 ( |
| 4 |
f118 char not null DEFAULT 'a', |
| 5 |
f119 char binary not null DEFAULT b'101', |
| 6 |
f120 char ascii not null DEFAULT b'101', |
| 7 |
f121 char(50), |
| 8 |
f122 char(50), |
| 9 |
f129 binary not null DEFAULT b'101', |
| 10 |
f130 tinyint not null DEFAULT 99, |
| 11 |
f131 tinyint unsigned not null DEFAULT 99, |
| 12 |
f132 tinyint zerofill not null DEFAULT 99, |
| 13 |
f133 tinyint unsigned zerofill not null DEFAULT 99, |
| 14 |
f134 smallint not null DEFAULT 999, |
| 15 |
f135 smallint unsigned not null DEFAULT 999, |
| 16 |
f136 smallint zerofill not null DEFAULT 999, |
| 17 |
f137 smallint unsigned zerofill not null DEFAULT 999, |
| 18 |
f138 mediumint not null DEFAULT 9999, |
| 19 |
f139 mediumint unsigned not null DEFAULT 9999, |
| 20 |
f140 mediumint zerofill not null DEFAULT 9999, |
| 21 |
f141 mediumint unsigned zerofill not null DEFAULT 9999, |
| 22 |
f142 int not null DEFAULT 99999, |
| 23 |
f143 int unsigned not null DEFAULT 99999, |
| 24 |
f144 int zerofill not null DEFAULT 99999, |
| 25 |
f145 int unsigned zerofill not null DEFAULT 99999, |
| 26 |
f146 bigint not null DEFAULT 999999, |
| 27 |
f147 bigint unsigned not null DEFAULT 999999, |
| 28 |
f148 bigint zerofill not null DEFAULT 999999, |
| 29 |
f149 bigint unsigned zerofill not null DEFAULT 999999, |
| 30 |
f150 decimal not null DEFAULT 999.999, |
| 31 |
f151 decimal unsigned not null DEFAULT 999.17, |
| 32 |
f152 decimal zerofill not null DEFAULT 999.999, |
| 33 |
f153 decimal unsigned zerofill, |
| 34 |
f154 decimal (0), |
| 35 |
f155 decimal (64), |
| 36 |
f156 decimal (0) unsigned, |
| 37 |
f157 decimal (64) unsigned, |
| 38 |
f158 decimal (0) zerofill, |
| 39 |
f159 decimal (64) zerofill, |
| 40 |
f160 decimal (0) unsigned zerofill, |
| 41 |
f161 decimal (64) unsigned zerofill, |
| 42 |
f162 decimal (0,0), |
| 43 |
f163 decimal (63,30), |
| 44 |
f164 decimal (0,0) unsigned, |
| 45 |
f165 decimal (63,30) unsigned, |
| 46 |
f166 decimal (0,0) zerofill, |
| 47 |
f167 decimal (63,30) zerofill, |
| 48 |
f168 decimal (0,0) unsigned zerofill, |
| 49 |
f169 decimal (63,30) unsigned zerofill, |
| 50 |
f170 numeric, |
| 51 |
f171 numeric unsigned, |
| 52 |
f172 numeric zerofill, |
| 53 |
f173 numeric unsigned zerofill, |
| 54 |
f174 numeric (0), |
| 55 |
f175 numeric (64) |
| 56 |
) charset latin1 engine = <engine_to_be_used>; |
| 57 |
Warnings: |
| 58 |
Warning 1287 'BINARY as attribute of a type' is deprecated and will be removed in a future release. Please use a CHARACTER SET clause with _bin collation instead |
| 59 |
Warning 1287 'ASCII' is deprecated and will be removed in a future release. Please use CHARACTER SET charset_name instead |
| 60 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 61 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 62 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 63 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 64 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 65 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 66 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 67 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 68 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 69 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 70 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 71 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 72 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 73 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 74 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 75 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 76 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 77 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 78 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 79 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 80 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 81 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 82 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 83 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 84 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 85 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 86 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 87 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 88 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 89 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 90 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 91 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 92 |
Warning 1681 The ZEROFILL attribute is deprecated and will be removed in a future release. Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column. |
| 93 |
Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release. |
| 94 |
Note 1265 Data truncated for column 'f150' at row 1 |
| 95 |
Note 1265 Data truncated for column 'f151' at row 1 |
| 96 |
Note 1265 Data truncated for column 'f152' at row 1 |
| 97 |
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb3.txt' |
| 98 |
into table tb3 character set latin1; |
| 99 |
Warnings: |
| 100 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 101 |
|
| 102 |
Testcase 3.5.10.1/2/3: |
| 103 |
---------------------- |
| 104 |
Warnings: |
| 105 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 106 |
Create view vw11 as select * from tb3 |
| 107 |
where f122 like 'Test 3.5.10.1/2/3%'; |
| 108 |
Create trigger trg1a before insert on tb3 |
| 109 |
for each row set new.f163=111.11; |
| 110 |
Create trigger trg1b after insert on tb3 |
| 111 |
for each row set @test_var='After Insert'; |
| 112 |
Create trigger trg1c before update on tb3 |
| 113 |
for each row set new.f121='Y', new.f122='Test 3.5.10.1/2/3-Update'; |
| 114 |
Create trigger trg1d after update on tb3 |
| 115 |
for each row set @test_var='After Update'; |
| 116 |
Create trigger trg1e before delete on tb3 |
| 117 |
for each row set @test_var=5; |
| 118 |
Create trigger trg1f after delete on tb3 |
| 119 |
for each row set @test_var= 2* @test_var+7; |
| 120 |
Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 1); |
| 121 |
Insert into vw11 (f122, f151) values ('Test 3.5.10.1/2/3', 2); |
| 122 |
Insert into vw11 (f122, f151) values ('Not in View', 3); |
| 123 |
select f121, f122, f151, f163 |
| 124 |
from tb3 where f122 like 'Test 3.5.10.1/2/3%' order by f151; |
| 125 |
f121 f122 f151 f163 |
| 126 |
NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000 |
| 127 |
NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000 |
| 128 |
select f121, f122, f151, f163 from vw11; |
| 129 |
f121 f122 f151 f163 |
| 130 |
NULL Test 3.5.10.1/2/3 1 111.110000000000000000000000000000 |
| 131 |
NULL Test 3.5.10.1/2/3 2 111.110000000000000000000000000000 |
| 132 |
select f121, f122, f151, f163 |
| 133 |
from tb3 where f122 like 'Not in View'; |
| 134 |
f121 f122 f151 f163 |
| 135 |
NULL Not in View 3 111.110000000000000000000000000000 |
| 136 |
Update vw11 set f163=1; |
| 137 |
select f121, f122, f151, f163 from tb3 |
| 138 |
where f122 like 'Test 3.5.10.1/2/3%' order by f151; |
| 139 |
f121 f122 f151 f163 |
| 140 |
Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000 |
| 141 |
Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 |
| 142 |
select f121, f122, f151, f163 from vw11; |
| 143 |
f121 f122 f151 f163 |
| 144 |
Y Test 3.5.10.1/2/3-Update 1 1.000000000000000000000000000000 |
| 145 |
Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 |
| 146 |
set @test_var=0; |
| 147 |
Select @test_var as 'before delete'; |
| 148 |
before delete |
| 149 |
0 |
| 150 |
delete from vw11 where f151=1; |
| 151 |
select f121, f122, f151, f163 from tb3 |
| 152 |
where f122 like 'Test 3.5.10.1/2/3%' order by f151; |
| 153 |
f121 f122 f151 f163 |
| 154 |
Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 |
| 155 |
select f121, f122, f151, f163 from vw11; |
| 156 |
f121 f122 f151 f163 |
| 157 |
Y Test 3.5.10.1/2/3-Update 2 1.000000000000000000000000000000 |
| 158 |
Select @test_var as 'after delete'; |
| 159 |
after delete |
| 160 |
17 |
| 161 |
drop view vw11; |
| 162 |
drop trigger trg1a; |
| 163 |
drop trigger trg1b; |
| 164 |
drop trigger trg1c; |
| 165 |
drop trigger trg1d; |
| 166 |
drop trigger trg1e; |
| 167 |
drop trigger trg1f; |
| 168 |
delete from tb3 where f122 like 'Test 3.5.10.1/2/3%'; |
| 169 |
Warnings: |
| 170 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 171 |
|
| 172 |
Testcase 3.5.10.4: |
| 173 |
------------------ |
| 174 |
Warnings: |
| 175 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 176 |
create table tb_load (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>; |
| 177 |
Create trigger trg4 before insert on tb_load |
| 178 |
for each row set new.f3=-(new.f1 div 5), @counter= @counter+1; |
| 179 |
set @counter= 0; |
| 180 |
select @counter as 'Rows Loaded Before'; |
| 181 |
Rows Loaded Before |
| 182 |
0 |
| 183 |
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t9.txt' into table tb_load character set latin1; |
| 184 |
select @counter as 'Rows Loaded After'; |
| 185 |
Rows Loaded After |
| 186 |
10 |
| 187 |
Select * from tb_load order by f1 limit 10; |
| 188 |
f1 f2 f3 |
| 189 |
-5000 a` 1000 |
| 190 |
-4999 aaa 999 |
| 191 |
-4998 abaa 999 |
| 192 |
-4997 acaaa 999 |
| 193 |
-4996 adaaaa 999 |
| 194 |
-4995 aeaaaaa 999 |
| 195 |
-4994 afaaaaaa 998 |
| 196 |
-4993 agaaaaaaa 998 |
| 197 |
-4992 a^aaaaaaaa 998 |
| 198 |
-4991 a_aaaaaaaaa 998 |
| 199 |
drop trigger trg4; |
| 200 |
drop table tb_load; |
| 201 |
Warnings: |
| 202 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 203 |
|
| 204 |
Testcase 3.5.10.5: (implemented in trig_frkey.test) |
| 205 |
--------------------------------------------------- |
| 206 |
Warnings: |
| 207 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 208 |
Warnings: |
| 209 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 210 |
|
| 211 |
Testcase 3.5.10.6: (implemented in trig_frkey.test) |
| 212 |
--------------------------------------------------- |
| 213 |
Warnings: |
| 214 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 215 |
Warnings: |
| 216 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 217 |
|
| 218 |
Testcase 3.5.10.extra: |
| 219 |
---------------------- |
| 220 |
Warnings: |
| 221 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 222 |
create table t1_sp (var136 tinyint, var151 decimal) engine = <engine_to_be_used>; |
| 223 |
create trigger trg before insert on t1_sp |
| 224 |
for each row set @counter=@counter+1; |
| 225 |
SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; |
| 226 |
create procedure trig_sp() |
| 227 |
begin |
| 228 |
declare done int default 0; |
| 229 |
declare var151 decimal; |
| 230 |
declare var136 tinyint; |
| 231 |
declare cur1 cursor for select f136, f151 from tb3; |
| 232 |
declare continue handler for sqlstate '01000' set done = 1; |
| 233 |
open cur1; |
| 234 |
fetch cur1 into var136, var151; |
| 235 |
wl_loop: WHILE NOT done DO |
| 236 |
insert into t1_sp values (var136, var151); |
| 237 |
fetch cur1 into var136, var151; |
| 238 |
END WHILE wl_loop; |
| 239 |
close cur1; |
| 240 |
end// |
| 241 |
set @counter=0; |
| 242 |
select @counter; |
| 243 |
@counter |
| 244 |
0 |
| 245 |
call trig_sp(); |
| 246 |
ERROR 02000: No data - zero rows fetched, selected, or processed |
| 247 |
select @counter; |
| 248 |
@counter |
| 249 |
11 |
| 250 |
select count(*) from tb3; |
| 251 |
count(*) |
| 252 |
11 |
| 253 |
select count(*) from t1_sp; |
| 254 |
count(*) |
| 255 |
11 |
| 256 |
drop procedure trig_sp; |
| 257 |
drop trigger trg; |
| 258 |
drop table t1_sp; |
| 259 |
Warnings: |
| 260 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 261 |
|
| 262 |
Testcase 3.5.11.1 (implemented in trig_perf.test) |
| 263 |
------------------------------------------------- |
| 264 |
Warnings: |
| 265 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 266 |
Warnings: |
| 267 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 268 |
|
| 269 |
Testcase y.y.y.2: Check for triggers starting triggers |
| 270 |
------------------------------------------------------ |
| 271 |
Warnings: |
| 272 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 273 |
use test; |
| 274 |
drop table if exists t1; |
| 275 |
drop table if exists t2_1; |
| 276 |
drop table if exists t2_2; |
| 277 |
drop table if exists t2_3; |
| 278 |
drop table if exists t2_4; |
| 279 |
drop table if exists t3; |
| 280 |
create table t1 (f1 integer) engine = <engine_to_be_used>; |
| 281 |
create table t2_1 (f1 integer) engine = <engine_to_be_used>; |
| 282 |
create table t2_2 (f1 integer) engine = <engine_to_be_used>; |
| 283 |
create table t2_3 (f1 integer) engine = <engine_to_be_used>; |
| 284 |
create table t2_4 (f1 integer) engine = <engine_to_be_used>; |
| 285 |
create table t3 (f1 integer) engine = <engine_to_be_used>; |
| 286 |
insert into t1 values (1); |
| 287 |
create trigger tr1 after insert on t1 for each row |
| 288 |
BEGIN |
| 289 |
insert into t2_1 (f1) values (new.f1+1); |
| 290 |
insert into t2_2 (f1) values (new.f1+1); |
| 291 |
insert into t2_3 (f1) values (new.f1+1); |
| 292 |
insert into t2_4 (f1) values (new.f1+1); |
| 293 |
END// |
| 294 |
create trigger tr2_1 after insert on t2_1 for each row |
| 295 |
insert into t3 (f1) values (new.f1+10); |
| 296 |
create trigger tr2_2 after insert on t2_2 for each row |
| 297 |
insert into t3 (f1) values (new.f1+100); |
| 298 |
create trigger tr2_3 after insert on t2_3 for each row |
| 299 |
insert into t3 (f1) values (new.f1+1000); |
| 300 |
create trigger tr2_4 after insert on t2_4 for each row |
| 301 |
insert into t3 (f1) values (new.f1+10000); |
| 302 |
insert into t1 values (1); |
| 303 |
select * from t3 order by f1; |
| 304 |
f1 |
| 305 |
12 |
| 306 |
102 |
| 307 |
1002 |
| 308 |
10002 |
| 309 |
drop trigger tr1; |
| 310 |
drop trigger tr2_1; |
| 311 |
drop trigger tr2_2; |
| 312 |
drop trigger tr2_3; |
| 313 |
drop trigger tr2_4; |
| 314 |
drop table t1, t2_1, t2_2, t2_3, t2_4, t3; |
| 315 |
Warnings: |
| 316 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 317 |
|
| 318 |
Testcase y.y.y.3: Circular trigger reference |
| 319 |
-------------------------------------------- |
| 320 |
Warnings: |
| 321 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 322 |
use test; |
| 323 |
drop table if exists t1; |
| 324 |
drop table if exists t2; |
| 325 |
drop table if exists t3; |
| 326 |
drop table if exists t4; |
| 327 |
create table t1 (f1 integer) engine = <engine_to_be_used>; |
| 328 |
create table t2 (f2 integer) engine = <engine_to_be_used>; |
| 329 |
create table t3 (f3 integer) engine = <engine_to_be_used>; |
| 330 |
create table t4 (f4 integer) engine = <engine_to_be_used>; |
| 331 |
insert into t1 values (0); |
| 332 |
create trigger tr1 after insert on t1 |
| 333 |
for each row insert into t2 (f2) values (new.f1+1); |
| 334 |
create trigger tr2 after insert on t2 |
| 335 |
for each row insert into t3 (f3) values (new.f2+1); |
| 336 |
create trigger tr3 after insert on t3 |
| 337 |
for each row insert into t4 (f4) values (new.f3+1); |
| 338 |
create trigger tr4 after insert on t4 |
| 339 |
for each row insert into t1 (f1) values (new.f4+1); |
| 340 |
insert into t1 values (1); |
| 341 |
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. |
| 342 |
select * from t1 order by f1; |
| 343 |
f1 |
| 344 |
0 |
| 345 |
select * from t2 order by f2; |
| 346 |
f2 |
| 347 |
select * from t3 order by f3; |
| 348 |
f3 |
| 349 |
select * from t4 order by f4; |
| 350 |
f4 |
| 351 |
drop trigger tr1; |
| 352 |
drop trigger tr2; |
| 353 |
drop trigger tr3; |
| 354 |
drop trigger tr4; |
| 355 |
drop table t1; |
| 356 |
drop table t2; |
| 357 |
drop table t3; |
| 358 |
drop table t4; |
| 359 |
Warnings: |
| 360 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 361 |
|
| 362 |
Testcase y.y.y.4: Recursive trigger/SP references |
| 363 |
------------------------------------------------- |
| 364 |
Warnings: |
| 365 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 366 |
set @sql_mode='traditional'; |
| 367 |
create table t1_sp ( |
| 368 |
count integer, |
| 369 |
var136 tinyint, |
| 370 |
var151 decimal) engine = <engine_to_be_used>; |
| 371 |
create procedure trig_sp() |
| 372 |
begin |
| 373 |
declare done int default 0; |
| 374 |
declare var151 decimal; |
| 375 |
declare var136 tinyint; |
| 376 |
declare cur1 cursor for select f136, f151 from tb3; |
| 377 |
declare continue handler for sqlstate '01000' set done = 1; |
| 378 |
set @counter= @counter+1; |
| 379 |
open cur1; |
| 380 |
fetch cur1 into var136, var151; |
| 381 |
wl_loop: WHILE NOT done DO |
| 382 |
insert into t1_sp values (@counter, var136, var151); |
| 383 |
fetch cur1 into var136, var151; |
| 384 |
END WHILE wl_loop; |
| 385 |
close cur1; |
| 386 |
end// |
| 387 |
create trigger trg before insert on t1_sp |
| 388 |
for each row call trig_sp(); |
| 389 |
set @counter=0; |
| 390 |
select @counter; |
| 391 |
@counter |
| 392 |
0 |
| 393 |
call trig_sp(); |
| 394 |
ERROR HY000: Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine trig_sp |
| 395 |
select @counter; |
| 396 |
@counter |
| 397 |
1 |
| 398 |
select count(*) from tb3; |
| 399 |
count(*) |
| 400 |
11 |
| 401 |
select count(*) from t1_sp; |
| 402 |
count(*) |
| 403 |
0 |
| 404 |
set @@max_sp_recursion_depth= 10; |
| 405 |
set @counter=0; |
| 406 |
select @counter; |
| 407 |
@counter |
| 408 |
0 |
| 409 |
call trig_sp(); |
| 410 |
ERROR HY000: Can't update table 't1_sp' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. |
| 411 |
select @counter; |
| 412 |
@counter |
| 413 |
2 |
| 414 |
select count(*) from tb3; |
| 415 |
count(*) |
| 416 |
11 |
| 417 |
select count(*) from t1_sp; |
| 418 |
count(*) |
| 419 |
0 |
| 420 |
drop procedure trig_sp; |
| 421 |
drop trigger trg; |
| 422 |
drop table t1_sp; |
| 423 |
Warnings: |
| 424 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 425 |
|
| 426 |
Testcase y.y.y.5: Rollback of nested trigger references |
| 427 |
------------------------------------------------------- |
| 428 |
Warnings: |
| 429 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 430 |
set @@sql_mode='traditional'; |
| 431 |
use test; |
| 432 |
drop table if exists t1; |
| 433 |
drop table if exists t2; |
| 434 |
drop table if exists t3; |
| 435 |
drop table if exists t4; |
| 436 |
create table t1 (f1 integer) engine = <engine_to_be_used>; |
| 437 |
create table t2 (f2 integer) engine = <engine_to_be_used>; |
| 438 |
create table t3 (f3 integer) engine = <engine_to_be_used>; |
| 439 |
create table t4 (f4 tinyint) engine = <engine_to_be_used>; |
| 440 |
insert into t1 values (1); |
| 441 |
create trigger tr1 after insert on t1 |
| 442 |
for each row insert into t2 (f2) values (new.f1+1); |
| 443 |
create trigger tr2 after insert on t2 |
| 444 |
for each row insert into t3 (f3) values (new.f2+1); |
| 445 |
create trigger tr3 after insert on t3 |
| 446 |
for each row insert into t4 (f4) values (new.f3+1000); |
| 447 |
set autocommit=0; |
| 448 |
start transaction; |
| 449 |
insert into t1 values (1); |
| 450 |
ERROR 22003: Out of range value for column 'f4' at row 1 |
| 451 |
commit; |
| 452 |
select * from t1 order by f1; |
| 453 |
f1 |
| 454 |
1 |
| 455 |
select * from t2 order by f2; |
| 456 |
f2 |
| 457 |
select * from t3 order by f3; |
| 458 |
f3 |
| 459 |
drop trigger tr1; |
| 460 |
drop trigger tr2; |
| 461 |
drop trigger tr3; |
| 462 |
drop table t1; |
| 463 |
drop table t2; |
| 464 |
drop table t3; |
| 465 |
drop table t4; |
| 466 |
DROP TABLE test.tb3; |
| 467 |
SET sql_mode = default; |