~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/suite/funcs_1/r/innodb_trig_0102.result

  • Committer: Brian Aker
  • Date: 2008-07-02 15:22:14 UTC
  • Revision ID: brian@tangent.org-20080702152214-ue73xgu0xogc5702
Removed SP, trig, and cursor tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 tinytext, 
8
 
f122 text, 
9
 
f123 mediumtext, 
10
 
f124 longtext unicode, 
11
 
f125 tinyblob, 
12
 
f126 blob, 
13
 
f127 mediumblob, 
14
 
f128 longblob, 
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, 
40
 
f154 decimal (0), 
41
 
f155 decimal (64), 
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, 
48
 
f162 decimal (0,0), 
49
 
f163 decimal (63,30), 
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, 
56
 
f170 numeric, 
57
 
f171 numeric unsigned, 
58
 
f172 numeric zerofill, 
59
 
f173 numeric unsigned zerofill, 
60
 
f174 numeric (0), 
61
 
f175 numeric (64) 
62
 
) engine = innodb;
63
 
Warnings:
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 ;
68
 
 
69
 
Testcase: 3.5.1.1:
70
 
------------------
71
 
use test;
72
 
Create trigger trg1_1 BEFORE INSERT 
73
 
on tb3 for each row set @test_before = 2, new.f142 = @test_before;
74
 
Create trigger trg1_2 AFTER INSERT 
75
 
on tb3 for each row set @test_after = 6;
76
 
Create trigger trg1_4 BEFORE UPDATE 
77
 
on tb3 for each row set @test_before = 27, 
78
 
new.f142 = @test_before, 
79
 
new.f122 = 'Before Update Trigger';
80
 
Create trigger trg1_3 AFTER UPDATE 
81
 
on tb3 for each row set @test_after = '15';
82
 
Create trigger trg1_5 BEFORE DELETE on tb3 for each row  
83
 
select count(*) into @test_before from tb3 as tr_tb3 
84
 
where f121 = 'Test 3.5.1.1';
85
 
Create trigger trg1_6 AFTER DELETE on tb3 for each row  
86
 
select count(*) into @test_after from tb3 as tr_tb3 
87
 
where f121 = 'Test 3.5.1.1';
88
 
set @test_before = 1;
89
 
set @test_after = 5;
90
 
select @test_before, @test_after;
91
 
@test_before    @test_after
92
 
1       5
93
 
Insert into tb3 (f121, f122, f142, f144, f134) 
94
 
values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1);
95
 
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
96
 
f121    f122    f142    f144    f134
97
 
Test 3.5.1.1    First Row       2       0000000005      1
98
 
select @test_before, @test_after;
99
 
@test_before    @test_after
100
 
2       6
101
 
set @test_before = 18;
102
 
set @test_after = 8;
103
 
select @test_before, @test_after;
104
 
@test_before    @test_after
105
 
18      8
106
 
Update tb3 set  tb3.f122 = 'Update', 
107
 
tb3.f142 = @test_before, 
108
 
tb3.f144 = @test_after 
109
 
where tb3.f121 = 'Test 3.5.1.1';
110
 
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
111
 
f121    f122    f142    f144    f134
112
 
Test 3.5.1.1    Before Update Trigger   27      0000000008      1
113
 
select @test_before, @test_after;
114
 
@test_before    @test_after
115
 
27      15
116
 
Insert into tb3 (f121, f122, f142, f144, f134) 
117
 
values ('Test 3.5.1.1', 'Second Row', 5, 6, 2);
118
 
set @test_before = 0;
119
 
set @test_after = 0;
120
 
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
121
 
f121    f122    f142    f144    f134
122
 
Test 3.5.1.1    Before Update Trigger   27      0000000008      1
123
 
Test 3.5.1.1    Second Row      2       0000000006      2
124
 
select @test_before, @test_after;
125
 
@test_before    @test_after
126
 
0       0
127
 
Delete from tb3 where f121 = 'Test 3.5.1.1' and f134 = 2;
128
 
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
129
 
f121    f122    f142    f144    f134
130
 
Test 3.5.1.1    Before Update Trigger   27      0000000008      1
131
 
select @test_before, @test_after;
132
 
@test_before    @test_after
133
 
2       1
134
 
drop trigger trg1_1;
135
 
drop trigger trg1_2;
136
 
drop trigger trg1_3;
137
 
drop trigger trg1_4;
138
 
drop trigger trg1_5;
139
 
drop trigger trg1_6;
140
 
delete from tb3 where f121='Test 3.5.1.1';
141
 
 
142
 
Testcase: 3.5.1.2:
143
 
------------------
144
 
Create trigger trg_1 after insert 
145
 
on tb3 for each statement set @x= 1;
146
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'statement set @x= 1' at line 2
147
 
drop trigger trg_1;
148
 
 
149
 
Testcase 3.5.1.3:
150
 
-----------------
151
 
CREATE TRIGGER trg3_1 on tb3 BEFORE INSERT for each row set new.f120 = 't';
152
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on tb3 BEFORE INSERT for each row set new.f120 = 't'' at line 1
153
 
CREATE trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's';
154
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'trg3_2 TRIGGER AFTER INSERT on tb3 for each row set new.f120 = 's'' at line 1
155
 
CREATE TRIGGER trg3_3 Before DELETE on tb3 set @ret1 = 'test' for each row;
156
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set @ret1 = 'test' for each row' at line 1
157
 
CREATE TRIGGER trg3_4 DELETE AFTER on tb3 set @ret1 = 'test' for each row;
158
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELETE AFTER on tb3 set @ret1 = 'test' for each row' at line 1
159
 
CREATE for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test';
160
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'for each row TRIGGER trg3_5 AFTER UPDATE on tb3 set @ret1 = 'test'' at line 1
161
 
drop trigger trg3_1;
162
 
drop trigger trg3_2;
163
 
drop trigger trg3_3;
164
 
drop trigger trg3_4;
165
 
drop trigger trg3_5;
166
 
 
167
 
Testcase: 3.5.1.5:
168
 
------------------
169
 
CREATE TRIGGER trg4_1 AFTER on tb3 for each row set new.f120 = 'e';
170
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on tb3 for each row set new.f120 = 'e'' at line 1
171
 
CREATE TRIGGER trg4_2 INSERT on tb3 for each set row  new.f120 = 'f';
172
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT on tb3 for each set row  new.f120 = 'f'' at line 1
173
 
CREATE TRIGGER trg4_3 BEFORE INSERT tb3 for each row set new.f120 = 'g';
174
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tb3 for each row set new.f120 = 'g'' at line 1
175
 
CREATE TRIGGER trg4_4 AFTER UPDATE on tb3 for each set new.f120 = 'g';
176
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set new.f120 = 'g'' at line 1
177
 
CREATE trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g';
178
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'trg4_5 AFTER DELETE on tb3 for each set new.f120 = 'g'' at line 1
179
 
CREATE TRIGGER trg4_6 BEFORE DELETE for each row set new.f120 = 'g';
180
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'for each row set new.f120 = 'g'' at line 1
181
 
drop trigger trg4_1;
182
 
drop trigger trg4_2;
183
 
drop trigger trg4_3;
184
 
drop trigger trg4_4;
185
 
drop trigger trg4_5;
186
 
drop trigger trg4_6;
187
 
 
188
 
Testcase 3.5.1.6: - Need to fix
189
 
-------------------------------
190
 
 
191
 
Testcase 3.5.1.7: - need to fix
192
 
-------------------------------
193
 
drop table if exists t1;
194
 
create table t1 (f1 int, f2 char(25),f3 int) engine=innodb;
195
 
CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 
196
 
for each row set new.f3 = '14';
197
 
CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
198
 
BEFORE UPDATE on test.t1 for each row set new.f3 = '42';
199
 
ERROR 42000: Identifier name 'trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ' is too long
200
 
CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX
201
 
BEFORE UPDATE on test.t1 for each row set new.f3 = '42';
202
 
insert into t1 (f2) values ('insert 3.5.1.7');
203
 
select * from t1;
204
 
f1      f2      f3
205
 
NULL    insert 3.5.1.7  14
206
 
update t1 set f2='update 3.5.1.7';
207
 
select * from t1;
208
 
f1      f2      f3
209
 
NULL    update 3.5.1.7  42
210
 
select trigger_name from information_schema.triggers order by trigger_name;
211
 
trigger_name
212
 
trg5_1
213
 
trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX
214
 
drop trigger trg5_1;
215
 
drop trigger trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ;
216
 
ERROR 42000: Identifier name 'trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ' is too long
217
 
drop trigger trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWX;
218
 
drop table t1;
219
 
 
220
 
Testcase 3.5.1.8:
221
 
-----------------
222
 
CREATE TRIGGER trg12* before insert on tb3 for each row set new.f120 = 't';
223
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* before insert on tb3 for each row set new.f120 = 't'' at line 1
224
 
CREATE TRIGGER trigger before insert on tb3 for each row set new.f120 = 't';
225
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'trigger before insert on tb3 for each row set new.f120 = 't'' at line 1
226
 
CREATE TRIGGER 100 before insert on tb3 for each row set new.f120 = 't';
227
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '100 before insert on tb3 for each row set new.f120 = 't'' at line 1
228
 
CREATE TRIGGER @@view before insert on tb3 for each row set new.f120 = 't';
229
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@@view before insert on tb3 for each row set new.f120 = 't'' at line 1
230
 
CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't';
231
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@name before insert on tb3 for each row set new.f120 = 't'' at line 1
232
 
CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3 
233
 
for each row set new.f120 ='X';
234
 
ERROR HY000: Trigger in wrong schema
235
 
drop database if exists trig_db;
236
 
create database trig_db;
237
 
use trig_db;
238
 
create table t1 (f1 integer) engine = innodb;
239
 
use test;
240
 
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 
241
 
for each row set @ret_trg6_2 = 5;
242
 
ERROR 42S02: Table 'trig_db.tb3' doesn't exist
243
 
use trig_db;
244
 
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 
245
 
for each row set @ret_trg6_3 = 18;
246
 
ERROR HY000: Trigger in wrong schema
247
 
use test;
248
 
drop database trig_db;
249
 
drop trigger trg6_1;
250
 
drop trigger trg6_3;
251
 
 
252
 
Testcase 3.5.1.9:(cannot be inplemented at this point)
253
 
------------------------------------------------------
254
 
 
255
 
Testcase 3.5.1.10:
256
 
------------------
257
 
CREATE TRIGGER trg7_1 BEFORE UPDATE on tb3 for each row set new.f120 ='X';
258
 
CREATE TRIGGER trg7_1 AFTER INSERT on tb3 for each row set @x ='Y';
259
 
ERROR HY000: Trigger already exists
260
 
drop trigger trg7_1;
261
 
 
262
 
Testcase 3.5.1.?:
263
 
-----------------
264
 
drop table if exists t1;
265
 
drop table if exists t2;
266
 
create table t1 (f1 char(50), f2 integer) engine = innodb;
267
 
create table t2 (f1 char(50), f2 integer) engine = innodb;
268
 
create trigger trig before insert on t1 
269
 
for each row set new.f1 ='trig t1';
270
 
create trigger trig before update on t2 
271
 
for each row set new.f1 ='trig t2';
272
 
ERROR HY000: Trigger already exists
273
 
insert into t1 value ('insert to t1',1);
274
 
select * from t1;
275
 
f1      f2
276
 
trig t1 1
277
 
update t1 set f1='update to t1';
278
 
select * from t1;
279
 
f1      f2
280
 
update to t1    1
281
 
insert into t2 value ('insert to t2',2);
282
 
update t2 set f1='update to t1';
283
 
select * from t2;
284
 
f1      f2
285
 
update to t1    2
286
 
drop table t1;
287
 
drop table t2;
288
 
drop trigger trig;
289
 
 
290
 
Testcase 3.5.1.11:
291
 
------------------
292
 
drop database if exists trig_db1;
293
 
drop database if exists trig_db2;
294
 
drop database if exists trig_db3;
295
 
create database trig_db1;
296
 
create database trig_db2;
297
 
create database trig_db3;
298
 
use trig_db1;
299
 
create table t1 (f1 char(50), f2 integer) engine = innodb;
300
 
create trigger trig before insert on t1 
301
 
for each row set new.f1 ='trig1', @test_var1='trig1';
302
 
use trig_db2;
303
 
create table t2 (f1 char(50), f2 integer) engine = innodb;
304
 
create trigger trig before insert on t2 
305
 
for each row set new.f1 ='trig2', @test_var2='trig2';
306
 
use trig_db3;
307
 
create table t1 (f1 char(50), f2 integer) engine = innodb;
308
 
create trigger trig before insert on t1 
309
 
for each row set new.f1 ='trig3', @test_var3='trig3';
310
 
set @test_var1= '', @test_var2= '', @test_var3= '';
311
 
use trig_db1;
312
 
insert into t1 (f1,f2) values ('insert to db1 t1',1);
313
 
insert into trig_db1.t1 (f1,f2) values ('insert to db1 t1 from db1',2);
314
 
insert into trig_db2.t2 (f1,f2) values ('insert to db2 t2 from db1',3);
315
 
insert into trig_db3.t1 (f1,f2) values ('insert to db3 t1 from db1',4);
316
 
select @test_var1, @test_var2, @test_var3;
317
 
@test_var1      @test_var2      @test_var3
318
 
trig1   trig2   trig3
319
 
select * from t1 order by f2;
320
 
f1      f2
321
 
trig1   1
322
 
trig1   2
323
 
select * from trig_db2.t2;
324
 
f1      f2
325
 
trig2   3
326
 
select * from trig_db3.t1;
327
 
f1      f2
328
 
trig3   4
329
 
select * from t1 order by f2;
330
 
f1      f2
331
 
trig1   1
332
 
trig1   2
333
 
use test;
334
 
drop database trig_db1;
335
 
drop database trig_db2;
336
 
drop database trig_db3;
337
 
 
338
 
Testcase 3.5.2.1/2/3:
339
 
---------------------
340
 
drop database if exists trig_db1;
341
 
drop database if exists trig_db2;
342
 
create database trig_db1;
343
 
create database trig_db2;
344
 
use trig_db1;
345
 
create table t1 (f1 char(50), f2 integer) engine = innodb;
346
 
create table trig_db2.t1 (f1 char(50), f2 integer) engine = innodb;
347
 
create trigger trig1_b before insert on t1 
348
 
for each row set @test_var1='trig1_b';
349
 
create trigger trig_db1.trig1_a after insert on t1 
350
 
for each row set @test_var2='trig1_a';
351
 
create trigger trig_db2.trig2 before insert on trig_db2.t1 
352
 
for each row set @test_var3='trig2';
353
 
select trigger_schema, trigger_name, event_object_table
354
 
from information_schema.triggers order by trigger_name;
355
 
trigger_schema  trigger_name    event_object_table
356
 
trig_db1        trig1_a t1
357
 
trig_db1        trig1_b t1
358
 
trig_db2        trig2   t1
359
 
set @test_var1= '', @test_var2= '', @test_var3= '';
360
 
insert into t1 (f1,f2) values ('insert to db1 t1 from db1',352);
361
 
insert into trig_db2.t1 (f1,f2) values ('insert to db2 t1 from db1',352);
362
 
select @test_var1, @test_var2, @test_var3;
363
 
@test_var1      @test_var2      @test_var3
364
 
trig1_b trig1_a trig2
365
 
drop database trig_db1;
366
 
drop database trig_db2;
367
 
DROP TABLE test.tb3;