~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/warnings.test

  • Committer: Jay Pipes
  • Date: 2009-09-15 21:01:42 UTC
  • mto: (1126.2.5 merge)
  • mto: This revision was merged to the branch mainline in revision 1128.
  • Revision ID: jpipes@serialcoder-20090915210142-x8mwiqn1q0vzjspp
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
SET SQL_WARNINGS=1;
8
8
 
9
9
create table t1 (a int);
10
 
--error ER_TABLE_EXISTS_ERROR
 
10
--error 1050
11
11
create table t1 (a int);
12
12
show count(*) errors;
13
13
show errors;
14
14
show warnings;
15
 
--error ER_PARSE_ERROR
 
15
--error 1064
16
16
create table t (i);
17
17
show count(*) errors;
18
18
show errors;
19
19
insert into t1 values (1);
20
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
 
20
--error 1366
21
21
insert into t1 values ("hej");
22
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
 
22
--error 1366
23
23
insert into t1 values ("hej"),("d�");
24
24
set SQL_WARNINGS=1;
25
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
 
25
--error 1366
26
26
insert into t1 values ("hej");
27
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
 
27
--error 1366
28
28
insert into t1 values ("hej"),("d�");
29
29
drop table t1;
30
30
set SQL_WARNINGS=0;
50
50
#
51
51
 
52
52
create table t1(a int, b int not null, c date, d char(5));
53
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
54
 
--error ER_WARN_NULL_TO_NOTNULL
55
 
eval load data infile '$DRIZZLETEST_VARDIR/std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
 
53
--error 1263
 
54
load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
56
55
# PS doesn't work good with @@warning_count
57
56
--disable_ps_protocol
58
57
select @@warning_count;
66
65
create table t1(a int NOT NULL, b int, c char(5));
67
66
 
68
67
# Error data to big for character field
69
 
--error ER_DATA_TOO_LONG
 
68
--error 1406
70
69
insert into t1 values(-1,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
71
70
insert into t1 values(-1,100,'mysql'),(10,-1,'dri '),(500,256,'zzle'),(20,NULL,'test');
72
71
 
73
72
# Error as changing width truncates data
74
 
--error ER_WARN_DATA_TRUNCATED  
 
73
--error 1265  
75
74
alter table t1 modify c char(4);
76
75
alter table t1 add d char(2);
77
76
 
78
77
# Error trying to insert NULL data into NOT NULL field
79
 
--error ER_BAD_NULL_ERROR
 
78
--error 1048
80
79
update t1 set a=NULL where a=10;
81
80
 
82
81
# Error data to big for character field
83
 
--error ER_DATA_TOO_LONG
 
82
--error 1406
84
83
update t1 set c='drizzle' where c='test';
85
84
 
86
85
# Error data to big for character field
87
 
--error ER_DATA_TOO_LONG
 
86
--error 1406
88
87
update t1 set d=c;
89
88
 
90
89
create table t2(a int NOT NULL, b char(3));
91
90
 
92
91
# Error data to big for character field
93
 
--error ER_DATA_TOO_LONG
 
92
--error 1406
94
93
insert into t2 select b,c from t1;
95
94
 
96
95
# Error 'a' doesn't have a default value
97
 
--error ER_NO_DEFAULT_FOR_FIELD
 
96
--error 1364
98
97
insert into t2(b) values('mysqlab');
99
98
insert into t2(a) values(1);
100
99
 
101
100
set sql_warnings=1;
102
101
 
103
102
# Error data to big for character field
104
 
--error ER_DATA_TOO_LONG
 
103
--error 1406
105
104
insert into t2(a,b) values(1,'mysqlab');
106
105
insert into t2(a,b) values(1,'mys');
107
106
 
127
126
set max_error_count=10;
128
127
 
129
128
# Error data to big for character field
130
 
--error ER_DATA_TOO_LONG
 
129
--error 1406
131
130
update t1 set b=a;
132
131
 
133
132
alter table t1 modify b char(10);
157
156
create table t1 (a int);
158
157
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
159
158
# Incorrect integer value abc for column a
160
 
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
 
159
--error 1366
161
160
update t1 set a='abc';
162
161
show warnings limit 2, 1;
163
162
show warnings limit 0, 10;
181
180
set @q = repeat('q', 256);
182
181
 
183
182
# BUG, 309791 currently only gives a warning but should give error
184
 
--error ER_DATA_TOO_LONG
185
183
insert into t1 values(@c, @c, @c);
186
184
show warnings;
187
 
--error ER_DATA_TOO_LONG
 
185
--error 1406
188
186
insert into t1 values(@q, NULL, NULL);
189
 
--error ER_DATA_TOO_LONG
 
187
--error 1406
190
188
insert into t1 values(NULL, @q, NULL);
191
189
insert into t1 values(NULL, NULL, @q);
192
190