2
drop table if exists 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',
10
f124 longtext unicode,
15
f129 binary not null DEFAULT b'101',
16
f130 tinyint not null DEFAULT 99,
17
f131 tinyint unsigned not null DEFAULT 99,
18
f132 tinyint zerofill not null DEFAULT 99,
19
f133 tinyint unsigned zerofill not null DEFAULT 99,
20
f134 smallint not null DEFAULT 999,
21
f135 smallint unsigned not null DEFAULT 999,
22
f136 smallint zerofill not null DEFAULT 999,
23
f137 smallint unsigned zerofill not null DEFAULT 999,
24
f138 mediumint not null DEFAULT 9999,
25
f139 mediumint unsigned not null DEFAULT 9999,
26
f140 mediumint zerofill not null DEFAULT 9999,
27
f141 mediumint unsigned zerofill not null DEFAULT 9999,
28
f142 int not null DEFAULT 99999,
29
f143 int unsigned not null DEFAULT 99999,
30
f144 int zerofill not null DEFAULT 99999,
31
f145 int unsigned zerofill not null DEFAULT 99999,
32
f146 bigint not null DEFAULT 999999,
33
f147 bigint unsigned not null DEFAULT 999999,
34
f148 bigint zerofill not null DEFAULT 999999,
35
f149 bigint unsigned zerofill not null DEFAULT 999999,
36
f150 decimal not null DEFAULT 999.999,
37
f151 decimal unsigned not null DEFAULT 999.17,
38
f152 decimal zerofill not null DEFAULT 999.999,
39
f153 decimal unsigned zerofill,
42
f156 decimal (0) unsigned,
43
f157 decimal (64) unsigned,
44
f158 decimal (0) zerofill,
45
f159 decimal (64) zerofill,
46
f160 decimal (0) unsigned zerofill,
47
f161 decimal (64) unsigned zerofill,
50
f164 decimal (0,0) unsigned,
51
f165 decimal (63,30) unsigned,
52
f166 decimal (0,0) zerofill,
53
f167 decimal (63,30) zerofill,
54
f168 decimal (0,0) unsigned zerofill,
55
f169 decimal (63,30) unsigned zerofill,
57
f171 numeric unsigned,
58
f172 numeric zerofill,
59
f173 numeric unsigned zerofill,
64
Note 1265 Data truncated for column 'f150' at row 1
65
Note 1265 Data truncated for column 'f151' at row 1
66
Note 1265 Data truncated for column 'f152' at row 1
67
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/innodb_tb3.txt' into table tb3 ;
71
Create trigger trg1 BEFORE UPDATE on tb3 for each row
72
set new.f142 = 94087, @counter=@counter+1;
82
Update tb3 Set f142='1' where f130<100;
83
select count(*) as ExpectedChanged, @counter as TrigCounter
84
from tb3 where f142=94087;
85
ExpectedChanged TrigCounter
87
select count(*) as ExpectedNotChange from tb3
88
where f130<100 and f142<>94087;
91
select count(*) as NonExpectedChanged from tb3
92
where f130>=130 and f142=94087;
99
Create trigger trg2_a before update on tb3 for each row
100
set @tr_var_b4_118=old.f118, @tr_var_b4_121=old.f121,
101
@tr_var_b4_122=old.f122, @tr_var_b4_136=old.f136,
102
@tr_var_b4_163=old.f163;
103
Create trigger trg2_b after update on tb3 for each row
104
set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121,
105
@tr_var_af_122=old.f122, @tr_var_af_136=old.f136,
106
@tr_var_af_163=old.f163;
107
Create trigger trg2_c before delete on tb3 for each row
108
set @tr_var_b4_118=old.f118, @tr_var_b4_121=old.f121,
109
@tr_var_b4_122=old.f122, @tr_var_b4_136=old.f136,
110
@tr_var_b4_163=old.f163;
111
Create trigger trg2_d after delete on tb3 for each row
112
set @tr_var_af_118=old.f118, @tr_var_af_121=old.f121,
113
@tr_var_af_122=old.f122, @tr_var_af_136=old.f136,
114
@tr_var_af_163=old.f163;
115
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163
117
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163
119
Insert into tb3 (f122, f136, f163)
120
values ('Test 3.5.9.3', 7, 123.17);
121
Update tb3 Set f136=8 where f122='Test 3.5.9.3';
122
select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136;
123
f118 f121 f122 f136 f163
124
a NULL Test 3.5.9.3 00008 123.170000000000000000000000000000
125
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
126
@tr_var_b4_136, @tr_var_b4_163;
127
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163
128
a NULL Test 3.5.9.3 7 123.170000000000000000000000000000
129
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
130
@tr_var_af_136, @tr_var_af_163;
131
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163
132
a NULL Test 3.5.9.3 7 123.170000000000000000000000000000
133
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163
135
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_163
137
delete from tb3 where f122='Test 3.5.9.3';
138
select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136;
139
f118 f121 f122 f136 f163
140
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
141
@tr_var_b4_136, @tr_var_b4_163;
142
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_163
143
a NULL Test 3.5.9.3 8 123.170000000000000000000000000000
151
Create trigger trg3_a before insert on tb3 for each row
152
set @tr_var_b4_118=new.f118, @tr_var_b4_121=new.f121,
153
@tr_var_b4_122=new.f122, @tr_var_b4_136=new.f136,
154
@tr_var_b4_151=new.f151, @tr_var_b4_163=new.f163;
155
Create trigger trg3_b after insert on tb3 for each row
156
set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121,
157
@tr_var_af_122=new.f122, @tr_var_af_136=new.f136,
158
@tr_var_af_151=new.f151, @tr_var_af_163=new.f163;
159
Create trigger trg3_c before update on tb3 for each row
160
set @tr_var_b4_118=new.f118, @tr_var_b4_121=new.f121,
161
@tr_var_b4_122=new.f122, @tr_var_b4_136=new.f136,
162
@tr_var_b4_151=new.f151, @tr_var_b4_163=new.f163;
163
Create trigger trg3_d after update on tb3 for each row
164
set @tr_var_af_118=new.f118, @tr_var_af_121=new.f121,
165
@tr_var_af_122=new.f122, @tr_var_af_136=new.f136,
166
@tr_var_af_151=new.f151, @tr_var_af_163=new.f163;
167
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163
169
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163
171
Insert into tb3 (f122, f136, f151, f163)
172
values ('Test 3.5.9.4', 7, DEFAULT, 995.24);
173
select f118, f121, f122, f136, f151, f163 from tb3
174
where f122 like 'Test 3.5.9.4%' order by f163;
175
f118 f121 f122 f136 f151 f163
176
a NULL Test 3.5.9.4 00007 999 995.240000000000000000000000000000
177
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
178
@tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163;
179
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163
180
a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
181
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
182
@tr_var_af_136, @tr_var_af_151, @tr_var_af_163;
183
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163
184
a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
185
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163
187
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163
189
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
190
where f122='Test 3.5.9.4';
191
ERROR 23000: Column 'f136' cannot be null
192
Update tb3 Set f122='Test 3.5.9.4-trig', f136=0, f151=DEFAULT, f163=NULL
193
where f122='Test 3.5.9.4';
194
select f118, f121, f122, f136, f151, f163 from tb3
195
where f122 like 'Test 3.5.9.4-trig' order by f163;
196
f118 f121 f122 f136 f151 f163
197
a NULL Test 3.5.9.4-trig 00000 999 NULL
198
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
199
@tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163;
200
@tr_var_b4_118 @tr_var_b4_121 @tr_var_b4_122 @tr_var_b4_136 @tr_var_b4_151 @tr_var_b4_163
201
a NULL Test 3.5.9.4-trig 0 999 NULL
202
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
203
@tr_var_af_136, @tr_var_af_151, @tr_var_af_163;
204
@tr_var_af_118 @tr_var_af_121 @tr_var_af_122 @tr_var_af_136 @tr_var_af_151 @tr_var_af_163
205
a NULL Test 3.5.9.4-trig 0 999 NULL
210
delete from tb3 where f122='Test 3.5.9.4-trig';
212
Testcase 3.5.9.5: (implied in previous tests)
213
---------------------------------------------
217
create trigger trg4a before insert on tb3 for each row
218
set @temp1= old.f120;
219
ERROR HY000: There is no OLD row in on INSERT trigger
220
create trigger trg4b after insert on tb3 for each row
221
set old.f120= 'test';
222
ERROR HY000: Updating of OLD row is not allowed in trigger
226
Testcase 3.5.9.7: (implied in previous tests)
227
---------------------------------------------
229
Testcase 3.5.9.8: (implied in previous tests)
230
---------------------------------------------
234
create trigger trg5a before DELETE on tb3 for each row
236
ERROR HY000: There is no NEW row in on DELETE trigger
237
create trigger trg5b after DELETE on tb3 for each row
239
ERROR HY000: There is no NEW row in on DELETE trigger
242
Testcase 3.5.9.10: (implied in previous tests)
243
----------------------------------------------
245
Testcase 3.5.9.11: covered by 3.5.9.9
246
-------------------------------------
248
Testcase 3.5.9.12: covered by 3.5.9.6
249
-------------------------------------
253
create trigger trg6a before UPDATE on tb3 for each row
254
set old.f118='C', new.f118='U';
255
ERROR HY000: Updating of OLD row is not allowed in trigger
256
create trigger trg6b after INSERT on tb3 for each row
257
set old.f136=163, new.f118='U';
258
ERROR HY000: Updating of OLD row is not allowed in trigger
259
create trigger trg6c after UPDATE on tb3 for each row
261
ERROR HY000: Updating of OLD row is not allowed in trigger
266
Testcase 3.5.9.14: (implied in previous tests)
267
----------------------------------------------