~jlukas79/+junk/mysql-server

« back to all changes in this revision

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

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
1
2
USE test;
2
 
drop table if exists tb3 ;
 
3
drop table if exists tb3;
3
4
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 = myisam;
 
5
f118 char not null DEFAULT 'a',
 
6
f119 char binary not null DEFAULT b'101',
 
7
f120 char ascii not null DEFAULT b'101',
 
8
f121 char(50),
 
9
f122 char(50),
 
10
f129 binary not null DEFAULT b'101',
 
11
f130 tinyint not null DEFAULT 99,
 
12
f131 tinyint unsigned not null DEFAULT 99,
 
13
f132 tinyint zerofill not null DEFAULT 99,
 
14
f133 tinyint unsigned zerofill not null DEFAULT 99,
 
15
f134 smallint not null DEFAULT 999,
 
16
f135 smallint unsigned not null DEFAULT 999,
 
17
f136 smallint zerofill not null DEFAULT 999,
 
18
f137 smallint unsigned zerofill not null DEFAULT 999,
 
19
f138 mediumint not null DEFAULT 9999,
 
20
f139 mediumint unsigned not null DEFAULT 9999,
 
21
f140 mediumint zerofill not null DEFAULT 9999,
 
22
f141 mediumint unsigned zerofill not null DEFAULT 9999,
 
23
f142 int not null DEFAULT 99999,
 
24
f143 int unsigned not null DEFAULT 99999,
 
25
f144 int zerofill not null DEFAULT 99999,
 
26
f145 int unsigned zerofill not null DEFAULT 99999,
 
27
f146 bigint not null DEFAULT 999999,
 
28
f147 bigint unsigned not null DEFAULT 999999,
 
29
f148 bigint zerofill not null DEFAULT 999999,
 
30
f149 bigint unsigned zerofill not null DEFAULT 999999,
 
31
f150 decimal not null DEFAULT 999.999,
 
32
f151 decimal unsigned not null DEFAULT 999.17,
 
33
f152 decimal zerofill not null DEFAULT 999.999,
 
34
f153 decimal unsigned zerofill,
 
35
f154 decimal (0),
 
36
f155 decimal (64),
 
37
f156 decimal (0) unsigned,
 
38
f157 decimal (64) unsigned,
 
39
f158 decimal (0) zerofill,
 
40
f159 decimal (64) zerofill,
 
41
f160 decimal (0) unsigned zerofill,
 
42
f161 decimal (64) unsigned zerofill,
 
43
f162 decimal (0,0),
 
44
f163 decimal (63,30),
 
45
f164 decimal (0,0) unsigned,
 
46
f165 decimal (63,30) unsigned,
 
47
f166 decimal (0,0) zerofill,
 
48
f167 decimal (63,30) zerofill,
 
49
f168 decimal (0,0) unsigned zerofill,
 
50
f169 decimal (63,30) unsigned zerofill,
 
51
f170 numeric,
 
52
f171 numeric unsigned,
 
53
f172 numeric zerofill,
 
54
f173 numeric unsigned zerofill,
 
55
f174 numeric (0),
 
56
f175 numeric (64)
 
57
) engine = <engine_to_be_used>;
63
58
Warnings:
64
59
Note    1265    Data truncated for column 'f150' at row 1
65
60
Note    1265    Data truncated for column 'f151' at row 1
66
61
Note    1265    Data truncated for column 'f152' at row 1
67
 
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/myisam_tb3.txt' into table tb3 ;
68
62
 
69
63
Testcase: 3.5.1.1:
70
64
------------------
71
65
use test;
72
 
Create trigger trg1_1 BEFORE INSERT 
 
66
Create trigger trg1_1 BEFORE INSERT
73
67
on tb3 for each row set @test_before = 2, new.f142 = @test_before;
74
 
Create trigger trg1_2 AFTER INSERT 
 
68
Create trigger trg1_2 AFTER INSERT
75
69
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, 
 
70
Create trigger trg1_4 BEFORE UPDATE
 
71
on tb3 for each row set @test_before = 27,
 
72
new.f142 = @test_before,
79
73
new.f122 = 'Before Update Trigger';
80
 
Create trigger trg1_3 AFTER UPDATE 
 
74
Create trigger trg1_3 AFTER UPDATE
81
75
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 
 
76
Create trigger trg1_5 BEFORE DELETE on tb3 for each row
 
77
select count(*) into @test_before from tb3 as tr_tb3
84
78
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 
 
79
Create trigger trg1_6 AFTER DELETE on tb3 for each row
 
80
select count(*) into @test_after from tb3 as tr_tb3
87
81
where f121 = 'Test 3.5.1.1';
88
82
set @test_before = 1;
89
83
set @test_after = 5;
90
84
select @test_before, @test_after;
91
85
@test_before    @test_after
92
86
1       5
93
 
Insert into tb3 (f121, f122, f142, f144, f134) 
 
87
Insert into tb3 (f121, f122, f142, f144, f134)
94
88
values ('Test 3.5.1.1', 'First Row', @test_before, @test_after, 1);
95
89
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
96
90
f121    f122    f142    f144    f134
103
97
select @test_before, @test_after;
104
98
@test_before    @test_after
105
99
18      8
106
 
Update tb3 set  tb3.f122 = 'Update', 
107
 
tb3.f142 = @test_before, 
108
 
tb3.f144 = @test_after 
 
100
Update tb3 set  tb3.f122 = 'Update',
 
101
tb3.f142 = @test_before,
 
102
tb3.f144 = @test_after
109
103
where tb3.f121 = 'Test 3.5.1.1';
110
104
select f121, f122, f142, f144, f134 from tb3 where f121 = 'Test 3.5.1.1';
111
105
f121    f122    f142    f144    f134
113
107
select @test_before, @test_after;
114
108
@test_before    @test_after
115
109
27      15
116
 
Insert into tb3 (f121, f122, f142, f144, f134) 
 
110
Insert into tb3 (f121, f122, f142, f144, f134)
117
111
values ('Test 3.5.1.1', 'Second Row', 5, 6, 2);
118
112
set @test_before = 0;
119
113
set @test_after = 0;
141
135
 
142
136
Testcase: 3.5.1.2:
143
137
------------------
144
 
Create trigger trg_1 after insert 
 
138
Create trigger trg_1 after insert
145
139
on tb3 for each statement set @x= 1;
146
140
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
141
drop trigger trg_1;
191
185
Testcase 3.5.1.7: - need to fix
192
186
-------------------------------
193
187
drop table if exists t1;
194
 
create table t1 (f1 int, f2 char(25),f3 int) engine=myisam;
195
 
CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1 
 
188
create table t1 (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>;
 
189
CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1
196
190
for each row set new.f3 = '14';
197
191
CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
198
192
BEFORE UPDATE on test.t1 for each row set new.f3 = '42';
229
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 '@@view before insert on tb3 for each row set new.f120 = 't'' at line 1
230
224
CREATE TRIGGER @name before insert on tb3 for each row set new.f120 = 't';
231
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 '@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 
 
226
CREATE TRIGGER tb3.trg6_1 BEFORE INSERT on test.tb3
233
227
for each row set new.f120 ='X';
234
228
ERROR HY000: Trigger in wrong schema
235
229
drop database if exists trig_db;
236
230
create database trig_db;
237
231
use trig_db;
238
 
create table t1 (f1 integer) engine = myisam;
 
232
create table t1 (f1 integer) engine = <engine_to_be_used>;
239
233
use test;
240
 
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 
 
234
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
241
235
for each row set @ret_trg6_2 = 5;
242
236
ERROR 42S02: Table 'trig_db.tb3' doesn't exist
243
237
use trig_db;
244
 
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 
 
238
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
245
239
for each row set @ret_trg6_3 = 18;
246
240
ERROR HY000: Trigger in wrong schema
247
241
use test;
263
257
-----------------
264
258
drop table if exists t1;
265
259
drop table if exists t2;
266
 
create table t1 (f1 char(50), f2 integer) engine = myisam;
267
 
create table t2 (f1 char(50), f2 integer) engine = myisam;
268
 
create trigger trig before insert on t1 
 
260
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
 
261
create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
 
262
create trigger trig before insert on t1
269
263
for each row set new.f1 ='trig t1';
270
 
create trigger trig before update on t2 
 
264
create trigger trig before update on t2
271
265
for each row set new.f1 ='trig t2';
272
266
ERROR HY000: Trigger already exists
273
267
insert into t1 value ('insert to t1',1);
296
290
create database trig_db2;
297
291
create database trig_db3;
298
292
use trig_db1;
299
 
create table t1 (f1 char(50), f2 integer) engine = myisam;
300
 
create trigger trig before insert on t1 
 
293
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
 
294
create trigger trig before insert on t1
301
295
for each row set new.f1 ='trig1', @test_var1='trig1';
302
296
use trig_db2;
303
 
create table t2 (f1 char(50), f2 integer) engine = myisam;
304
 
create trigger trig before insert on t2 
 
297
create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
 
298
create trigger trig before insert on t2
305
299
for each row set new.f1 ='trig2', @test_var2='trig2';
306
300
use trig_db3;
307
 
create table t1 (f1 char(50), f2 integer) engine = myisam;
308
 
create trigger trig before insert on t1 
 
301
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
 
302
create trigger trig before insert on t1
309
303
for each row set new.f1 ='trig3', @test_var3='trig3';
310
304
set @test_var1= '', @test_var2= '', @test_var3= '';
311
305
use trig_db1;
342
336
create database trig_db1;
343
337
create database trig_db2;
344
338
use trig_db1;
345
 
create table t1 (f1 char(50), f2 integer) engine = myisam;
346
 
create table trig_db2.t1 (f1 char(50), f2 integer) engine = myisam;
347
 
create trigger trig1_b before insert on t1 
 
339
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
 
340
create table trig_db2.t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
 
341
create trigger trig1_b before insert on t1
348
342
for each row set @test_var1='trig1_b';
349
 
create trigger trig_db1.trig1_a after insert on t1 
 
343
create trigger trig_db1.trig1_a after insert on t1
350
344
for each row set @test_var2='trig1_a';
351
 
create trigger trig_db2.trig2 before insert on trig_db2.t1 
 
345
create trigger trig_db2.trig2 before insert on trig_db2.t1
352
346
for each row set @test_var3='trig2';
353
347
select trigger_schema, trigger_name, event_object_table
354
348
from information_schema.triggers order by trigger_name;