~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);
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
10
--error ER_TABLE_EXISTS_ERROR
1 by brian
clean slate
11
create table t1 (a int);
12
show count(*) errors;
13
show errors;
14
show warnings;
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
15
--error ER_PARSE_ERROR
1 by brian
clean slate
16
create table t (i);
17
show count(*) errors;
18
show errors;
19
insert into t1 values (1);
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
20
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
21
insert into t1 values ("hej");
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
22
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
23
insert into t1 values ("hej"),("då");
24
set SQL_WARNINGS=1;
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
25
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
26
insert into t1 values ("hej");
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
27
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
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));
1878.7.1 by patrick crews
Updated tests to use variable vardir rather than a hard-coded one
53
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
54
--error ER_WARN_NULL_TO_NOTNULL
1878.7.1 by patrick crews
Updated tests to use variable vardir rather than a hard-coded one
55
eval load data infile '$DRIZZLETEST_VARDIR/std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
1 by brian
clean slate
56
# PS doesn't work good with @@warning_count
57
--disable_ps_protocol
58
select @@warning_count;
59
--enable_ps_protocol
60
drop table t1;
61
62
#
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
63
# Errors and Warnings from basic INSERT, UPDATE and ALTER commands
1 by brian
clean slate
64
#
65
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
66
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
67
68
# Error data to big for character field
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
69
--error ER_DATA_TOO_LONG
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
70
insert into t1 values(-1,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
71
insert into t1 values(-1,100,'mysql'),(10,-1,'dri '),(500,256,'zzle'),(20,NULL,'test');
72
73
# Error as changing width truncates data
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
74
--error ER_WARN_DATA_TRUNCATED  
1 by brian
clean slate
75
alter table t1 modify c char(4);
76
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
77
78
# Error trying to insert NULL data into NOT NULL field
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
79
--error ER_BAD_NULL_ERROR
1 by brian
clean slate
80
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
81
82
# Error data to big for character field
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
83
--error ER_DATA_TOO_LONG
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
84
update t1 set c='drizzle' where c='test';
85
86
# Error data to big for character field
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
87
--error ER_DATA_TOO_LONG
1 by brian
clean slate
88
update t1 set d=c;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
89
396 by Brian Aker
Cleanup tiny and small int.
90
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
91
92
# Error data to big for character field
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
93
--error ER_DATA_TOO_LONG
1 by brian
clean slate
94
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
95
96
# Error 'a' doesn't have a default value
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
97
--error ER_NO_DEFAULT_FOR_FIELD
1 by brian
clean slate
98
insert into t2(b) values('mysqlab');
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
99
insert into t2(a) values(1);
100
1 by brian
clean slate
101
set sql_warnings=1;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
102
103
# Error data to big for character field
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
104
--error ER_DATA_TOO_LONG
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
105
insert into t2(a,b) values(1,'mysqlab');
106
insert into t2(a,b) values(1,'mys');
107
1 by brian
clean slate
108
set sql_warnings=0;
109
drop table t1, t2;
110
111
#
112
# Test for max_error_count
113
#
114
115
create table t1(a char(10));
116
let $1=50;
117
disable_query_log;
910.4.13 by Stewart Smith
batch up more INSERTs into transactions to help tests run quicker.
118
begin;
1 by brian
clean slate
119
while ($1)
120
{
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
121
  eval insert into t1 values('drizzle ab');
1 by brian
clean slate
122
  dec $1;
123
}
910.4.13 by Stewart Smith
batch up more INSERTs into transactions to help tests run quicker.
124
commit;
1 by brian
clean slate
125
enable_query_log;
126
alter table t1 add b char;
127
set max_error_count=10;
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
128
129
# Error data to big for character field
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
130
--error ER_DATA_TOO_LONG
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
131
update t1 set b=a;
132
133
alter table t1 modify b char(10);
1 by brian
clean slate
134
update t1 set b=a;
135
--disable_ps_protocol
136
select @@warning_count;
137
--enable_ps_protocol
138
139
# Bug#9072
140
set max_error_count=0;
141
show variables like 'max_error_count';
142
update t1 set b='hi';
143
--disable_ps_protocol
144
select @@warning_count;
145
--enable_ps_protocol
146
show warnings;
147
set max_error_count=65535;
148
show variables like 'max_error_count';
149
set max_error_count=10;
150
show variables like 'max_error_count';
151
152
drop table t1;
153
154
#
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
155
# Tests for show errors and warnings limit a, b
1 by brian
clean slate
156
#
157
create table t1 (a int);
158
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
159
# Incorrect integer value abc for column a
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
160
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
161
update t1 set a='abc';
162
show warnings limit 2, 1;
163
show warnings limit 0, 10;
164
show warnings limit 9, 1;
165
show warnings limit 10, 1;
166
show warnings limit 9, 2;
167
show warnings limit 0, 0;
168
show warnings limit 1;
169
show warnings limit 0;
170
show warnings limit 1, 0;
171
# make sure behaviour is consistent with select ... limit
172
select * from t1 limit 0;
173
select * from t1 limit 1, 0;
174
select * from t1 limit 0, 0;
175
drop table t1;
176
177
--echo End of 4.1 tests
178
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
179
create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext blob);
1 by brian
clean slate
180
set @c = repeat(' ', 256);
181
set @q = repeat('q', 256);
182
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
183
# BUG, 309791 currently only gives a warning but should give error
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
184
--error ER_DATA_TOO_LONG
642.1.41 by Lee
enable warnings test and fix timezone test to comment out the failing test
185
insert into t1 values(@c, @c, @c);
186
show warnings;
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
187
--error ER_DATA_TOO_LONG
1 by brian
clean slate
188
insert into t1 values(@q, NULL, NULL);
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
189
--error ER_DATA_TOO_LONG
1 by brian
clean slate
190
insert into t1 values(NULL, @q, NULL);
191
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
192
193
drop table t1;
194
195
--echo End of Drizzle tests