~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/warnings.test

  • Committer: Monty Taylor
  • Date: 2008-08-01 23:59:59 UTC
  • mto: (236.1.42 codestyle)
  • mto: This revision was merged to the branch mainline in revision 261.
  • Revision ID: monty@inaugust.com-20080801235959-n8ypy9r5aohown77
Gettext error compiles and passes test!

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 ER_TABLE_EXISTS_ERROR
11
 
create table t1 (a int);
12
 
show count(*) errors;
13
 
show errors;
14
 
show warnings;
15
 
--error ER_PARSE_ERROR
16
 
create table t (i);
17
 
show count(*) errors;
18
 
show errors;
19
 
insert into t1 values (1);
20
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
21
 
insert into t1 values ("hej");
22
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
23
 
insert into t1 values ("hej"),("d�");
24
 
set SQL_WARNINGS=1;
25
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
26
 
insert into t1 values ("hej");
27
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
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
 
#
49
 
# Test error for LOAD DATA INFILE
50
 
#
51
 
 
52
 
create table t1(a int, b int not null, c date, d char(5));
53
 
--error ER_WARN_NULL_TO_NOTNULL
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
 
#
62
 
# Errors and Warnings from basic INSERT, UPDATE and ALTER commands
63
 
#
64
 
 
65
 
create table t1(a int NOT NULL, b int, c char(5));
66
 
 
67
 
# Error data to big for character field
68
 
--error ER_DATA_TOO_LONG
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 ER_WARN_DATA_TRUNCATED  
74
 
alter table t1 modify c char(4);
75
 
alter table t1 add d char(2);
76
 
 
77
 
# Error trying to insert NULL data into NOT NULL field
78
 
--error ER_BAD_NULL_ERROR
79
 
update t1 set a=NULL where a=10;
80
 
 
81
 
# Error data to big for character field
82
 
--error ER_DATA_TOO_LONG
83
 
update t1 set c='drizzle' where c='test';
84
 
 
85
 
# Error data to big for character field
86
 
--error ER_DATA_TOO_LONG
87
 
update t1 set d=c;
88
 
 
89
 
create table t2(a int NOT NULL, b char(3));
90
 
 
91
 
# Error data to big for character field
92
 
--error ER_DATA_TOO_LONG
93
 
insert into t2 select b,c from t1;
94
 
 
95
 
# Error 'a' doesn't have a default value
96
 
--error ER_NO_DEFAULT_FOR_FIELD
97
 
insert into t2(b) values('mysqlab');
98
 
insert into t2(a) values(1);
99
 
 
100
 
set sql_warnings=1;
101
 
 
102
 
# Error data to big for character field
103
 
--error ER_DATA_TOO_LONG
104
 
insert into t2(a,b) values(1,'mysqlab');
105
 
insert into t2(a,b) values(1,'mys');
106
 
 
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
 
begin;
118
 
while ($1)
119
 
{
120
 
  eval insert into t1 values('drizzle ab');
121
 
  dec $1;
122
 
}
123
 
commit;
124
 
enable_query_log;
125
 
alter table t1 add b char;
126
 
set max_error_count=10;
127
 
 
128
 
# Error data to big for character field
129
 
--error ER_DATA_TOO_LONG
130
 
update t1 set b=a;
131
 
 
132
 
alter table t1 modify b char(10);
133
 
update t1 set b=a;
134
 
--disable_ps_protocol
135
 
select @@warning_count;
136
 
--enable_ps_protocol
137
 
 
138
 
# Bug#9072
139
 
set max_error_count=0;
140
 
show variables like 'max_error_count';
141
 
update t1 set b='hi';
142
 
--disable_ps_protocol
143
 
select @@warning_count;
144
 
--enable_ps_protocol
145
 
show warnings;
146
 
set max_error_count=65535;
147
 
show variables like 'max_error_count';
148
 
set max_error_count=10;
149
 
show variables like 'max_error_count';
150
 
 
151
 
drop table t1;
152
 
 
153
 
#
154
 
# Tests for show errors and warnings limit a, b
155
 
#
156
 
create table t1 (a int);
157
 
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
158
 
# Incorrect integer value abc for column a
159
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
160
 
update t1 set a='abc';
161
 
show warnings limit 2, 1;
162
 
show warnings limit 0, 10;
163
 
show warnings limit 9, 1;
164
 
show warnings limit 10, 1;
165
 
show warnings limit 9, 2;
166
 
show warnings limit 0, 0;
167
 
show warnings limit 1;
168
 
show warnings limit 0;
169
 
show warnings limit 1, 0;
170
 
# make sure behaviour is consistent with select ... limit
171
 
select * from t1 limit 0;
172
 
select * from t1 limit 1, 0;
173
 
select * from t1 limit 0, 0;
174
 
drop table t1;
175
 
 
176
 
--echo End of 4.1 tests
177
 
 
178
 
create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext blob);
179
 
set @c = repeat(' ', 256);
180
 
set @q = repeat('q', 256);
181
 
 
182
 
# BUG, 309791 currently only gives a warning but should give error
183
 
--error ER_DATA_TOO_LONG
184
 
insert into t1 values(@c, @c, @c);
185
 
show warnings;
186
 
--error ER_DATA_TOO_LONG
187
 
insert into t1 values(@q, NULL, NULL);
188
 
--error ER_DATA_TOO_LONG
189
 
insert into t1 values(NULL, @q, NULL);
190
 
insert into t1 values(NULL, NULL, @q);
191
 
 
192
 
drop table t1;
193
 
 
194
 
--echo End of Drizzle tests