~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Test some warnings
3
#
4
--disable_warnings
5
drop table if exists t1, t2;
6
--enable_warnings
7
SET SQL_WARNINGS=1;
8
9
create table t1 (a int);
10
--error 1050
11
create table t1 (a int);
12
show count(*) errors;
13
show errors;
14
show warnings;
15
--error 1064
16
create table t (i);
17
show count(*) errors;
18
show errors;
19
insert into t1 values (1);
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
20
--error 1366
1 by brian
clean slate
21
insert into t1 values ("hej");
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
22
--error 1366
1 by brian
clean slate
23
insert into t1 values ("hej"),("då");
24
set SQL_WARNINGS=1;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
25
--error 1366
1 by brian
clean slate
26
insert into t1 values ("hej");
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
27
--error 1366
1 by brian
clean slate
28
insert into t1 values ("hej"),("då");
29
drop table t1;
30
set SQL_WARNINGS=0;
31
32
#
33
# Test other warnings
34
#
35
36
drop temporary table if exists not_exists;
37
drop table if exists not_exists_table;
38
show warnings limit 1;
39
drop database if exists not_exists_db;
40
show count(*) warnings;
41
create table t1(id int);
42
create table if not exists t1(id int);
43
--disable_ps_protocol
44
select @@warning_count;
45
--enable_ps_protocol
46
drop table t1;
47
48
#
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
49
# Test error for LOAD DATA INFILE
1 by brian
clean slate
50
#
51
396 by Brian Aker
Cleanup tiny and small int.
52
create table t1(a int, b int not null, c date, d char(5));
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
53
--error 1263
1 by brian
clean slate
54
load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
55
# PS doesn't work good with @@warning_count
56
--disable_ps_protocol
57
select @@warning_count;
58
--enable_ps_protocol
59
drop table t1;
60
61
#
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
62
# Errors and Warnings from basic INSERT, UPDATE and ALTER commands
1 by brian
clean slate
63
#
64
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
65
create table t1(a int NOT NULL, b int, c char(5));
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
66
67
# Error data to big for character field
68
--error 1406
69
insert into t1 values(-1,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
70
insert into t1 values(-1,100,'mysql'),(10,-1,'dri '),(500,256,'zzle'),(20,NULL,'test');
71
72
# Error as changing width truncates data
73
--error 1265  
1 by brian
clean slate
74
alter table t1 modify c char(4);
75
alter table t1 add d char(2);
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
76
77
# Error trying to insert NULL data into NOT NULL field
1 by brian
clean slate
78
--error 1048
79
update t1 set a=NULL where a=10;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
80
81
# Error data to big for character field
82
--error 1406
83
update t1 set c='drizzle' where c='test';
84
85
# Error data to big for character field
86
--error 1406
1 by brian
clean slate
87
update t1 set d=c;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
88
396 by Brian Aker
Cleanup tiny and small int.
89
create table t2(a int NOT NULL, b char(3));
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
90
91
# Error data to big for character field
92
--error 1406
1 by brian
clean slate
93
insert into t2 select b,c from t1;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
94
95
# Error 'a' doesn't have a default value
96
--error 1364
1 by brian
clean slate
97
insert into t2(b) values('mysqlab');
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
98
insert into t2(a) values(1);
99
1 by brian
clean slate
100
set sql_warnings=1;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
101
102
# Error data to big for character field
103
--error 1406
104
insert into t2(a,b) values(1,'mysqlab');
105
insert into t2(a,b) values(1,'mys');
106
1 by brian
clean slate
107
set sql_warnings=0;
108
drop table t1, t2;
109
110
#
111
# Test for max_error_count
112
#
113
114
create table t1(a char(10));
115
let $1=50;
116
disable_query_log;
117
while ($1)
118
{
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
119
  eval insert into t1 values('drizzle ab');
1 by brian
clean slate
120
  dec $1;
121
}
122
enable_query_log;
123
alter table t1 add b char;
124
set max_error_count=10;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
125
126
# Error data to big for character field
127
--error 1406
128
update t1 set b=a;
129
130
alter table t1 modify b char(10);
1 by brian
clean slate
131
update t1 set b=a;
132
--disable_ps_protocol
133
select @@warning_count;
134
--enable_ps_protocol
135
136
# Bug#9072
137
set max_error_count=0;
138
show variables like 'max_error_count';
139
update t1 set b='hi';
140
--disable_ps_protocol
141
select @@warning_count;
142
--enable_ps_protocol
143
show warnings;
144
set max_error_count=65535;
145
show variables like 'max_error_count';
146
set max_error_count=10;
147
show variables like 'max_error_count';
148
149
drop table t1;
150
151
#
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
152
# Tests for show errors and warnings limit a, b
1 by brian
clean slate
153
#
154
create table t1 (a int);
155
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
156
# Incorrect integer value abc for column a
157
--error 1366
1 by brian
clean slate
158
update t1 set a='abc';
159
show warnings limit 2, 1;
160
show warnings limit 0, 10;
161
show warnings limit 9, 1;
162
show warnings limit 10, 1;
163
show warnings limit 9, 2;
164
show warnings limit 0, 0;
165
show warnings limit 1;
166
show warnings limit 0;
167
show warnings limit 1, 0;
168
# make sure behaviour is consistent with select ... limit
169
select * from t1 limit 0;
170
select * from t1 limit 1, 0;
171
select * from t1 limit 0, 0;
172
drop table t1;
173
174
--echo End of 4.1 tests
175
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
176
create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext blob);
1 by brian
clean slate
177
set @c = repeat(' ', 256);
178
set @q = repeat('q', 256);
179
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
180
# BUG, 309791 currently only gives a warning but should give error
181
insert into t1 values(@c, @c, @c);
182
show warnings;
1 by brian
clean slate
183
--error 1406
184
insert into t1 values(@q, NULL, NULL);
185
--error 1406
186
insert into t1 values(NULL, @q, NULL);
187
insert into t1 values(NULL, NULL, @q);
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
188
189
drop table t1;
190
191
--echo End of Drizzle tests