~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/warnings.test

  • Committer: Monty Taylor
  • Date: 2008-07-22 05:48:51 UTC
  • mto: (202.1.3 toru)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: monty@inaugust.com-20080722054851-airxt73370725p7x
Re-enabled optimizations for the normal build, and added back the --with-debug option to turn them off. 

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 1050
11
 
create table t1 (a int);
12
 
show count(*) errors;
13
 
show errors;
14
 
show warnings;
15
 
--error 1115
16
 
create table t2(a int) default charset qwerty;
17
 
show count(*) errors;
18
 
show errors;
19
 
--error 1064
20
 
create table t (i);
21
 
show count(*) errors;
22
 
show errors;
23
 
insert into t1 values (1);
24
 
insert into t1 values ("hej");
25
 
insert into t1 values ("hej"),("d�");
26
 
set SQL_WARNINGS=1;
27
 
insert into t1 values ("hej");
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 warnings for LOAD DATA INFILE
50
 
#
51
 
 
52
 
create table t1(a int, b int not null, c date, d char(5));
53
 
load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
54
 
# PS doesn't work good with @@warning_count
55
 
--disable_ps_protocol
56
 
select @@warning_count;
57
 
--enable_ps_protocol
58
 
drop table t1;
59
 
 
60
 
#
61
 
# Warnings from basic INSERT, UPDATE and ALTER commands
62
 
#
63
 
 
64
 
create table t1(a int NOT NULL, b int, c char(5));
65
 
insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
66
 
alter table t1 modify c char(4);
67
 
alter table t1 add d char(2);
68
 
--error 1048
69
 
update t1 set a=NULL where a=10;
70
 
update t1 set c='mysql ab' where c='test';
71
 
update t1 set d=c;
72
 
create table t2(a int NOT NULL, b char(3));
73
 
insert into t2 select b,c from t1;
74
 
insert into t2(b) values('mysqlab');
75
 
set sql_warnings=1;
76
 
insert into t2(b) values('mysqlab');
77
 
set sql_warnings=0;
78
 
drop table t1, t2;
79
 
 
80
 
#
81
 
# Test for max_error_count
82
 
#
83
 
 
84
 
create table t1(a char(10));
85
 
let $1=50;
86
 
disable_query_log;
87
 
while ($1)
88
 
{
89
 
  eval insert into t1 values('mysql ab');
90
 
  dec $1;
91
 
}
92
 
enable_query_log;
93
 
alter table t1 add b char;
94
 
set max_error_count=10;
95
 
update t1 set b=a;
96
 
--disable_ps_protocol
97
 
select @@warning_count;
98
 
--enable_ps_protocol
99
 
 
100
 
# Bug#9072
101
 
set max_error_count=0;
102
 
show variables like 'max_error_count';
103
 
update t1 set b='hi';
104
 
--disable_ps_protocol
105
 
select @@warning_count;
106
 
--enable_ps_protocol
107
 
show warnings;
108
 
set max_error_count=65535;
109
 
show variables like 'max_error_count';
110
 
set max_error_count=10;
111
 
show variables like 'max_error_count';
112
 
 
113
 
drop table t1;
114
 
 
115
 
#
116
 
# Tests for show warnings limit a, b
117
 
#
118
 
create table t1 (a int);
119
 
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
120
 
# should generate 10 warnings
121
 
update t1 set a='abc';
122
 
show warnings limit 2, 1;
123
 
show warnings limit 0, 10;
124
 
show warnings limit 9, 1;
125
 
show warnings limit 10, 1;
126
 
show warnings limit 9, 2;
127
 
show warnings limit 0, 0;
128
 
show warnings limit 1;
129
 
show warnings limit 0;
130
 
show warnings limit 1, 0;
131
 
# make sure behaviour is consistent with select ... limit
132
 
select * from t1 limit 0;
133
 
select * from t1 limit 1, 0;
134
 
select * from t1 limit 0, 0;
135
 
drop table t1;
136
 
 
137
 
--echo End of 4.1 tests
138
 
 
139
 
#
140
 
# Bug#20778: strange characters in warning message 1366 when called in SP
141
 
#
142
 
 
143
 
CREATE TABLE t1( f1 CHAR(20) );
144
 
CREATE TABLE t2( f1 CHAR(20), f2 CHAR(25) );
145
 
CREATE TABLE t3( f1 CHAR(20), f2 CHAR(25), f3 DATE );
146
 
 
147
 
INSERT INTO t1 VALUES ( 'a`' );
148
 
INSERT INTO t2 VALUES ( 'a`', 'a`' );
149
 
INSERT INTO t3 VALUES ( 'a`', 'a`', '1000-01-1' );
150
 
 
151
 
DROP PROCEDURE IF EXISTS sp1;
152
 
DROP PROCEDURE IF EXISTS sp2;
153
 
DROP PROCEDURE IF EXISTS sp3;
154
 
delimiter //;
155
 
CREATE PROCEDURE sp1()
156
 
BEGIN
157
 
   DECLARE x NUMERIC ZEROFILL;
158
 
   SELECT f1 INTO x FROM t1 LIMIT 1;
159
 
END//
160
 
CREATE PROCEDURE sp2()
161
 
BEGIN
162
 
   DECLARE x NUMERIC ZEROFILL;
163
 
   SELECT f1 INTO x FROM t2 LIMIT 1;
164
 
END//
165
 
CREATE PROCEDURE sp3()
166
 
BEGIN
167
 
   DECLARE x NUMERIC ZEROFILL;
168
 
   SELECT f1 INTO x FROM t3 LIMIT 1;
169
 
END//
170
 
delimiter ;//
171
 
CALL sp1();
172
 
CALL sp2();
173
 
CALL sp3();
174
 
 
175
 
DROP PROCEDURE IF EXISTS sp1;
176
 
delimiter //;
177
 
CREATE PROCEDURE sp1()
178
 
BEGIN
179
 
declare x numeric zerofill;
180
 
SELECT f1 into x from t2 limit 1;
181
 
END//
182
 
delimiter ;//
183
 
CALL sp1();
184
 
DROP TABLE t1;
185
 
DROP TABLE t2;
186
 
DROP TABLE t3;
187
 
DROP PROCEDURE sp1;
188
 
DROP PROCEDURE sp2;
189
 
DROP PROCEDURE sp3;
190
 
 
191
 
 
192
 
#
193
 
# Bug#30059: End-space truncation warnings are inconsistent or incorrect
194
 
#
195
 
 
196
 
create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext);
197
 
create table t2 (c_tinyblob tinyblob); # not affected by bug, for regression testing
198
 
set @c = repeat(' ', 256);
199
 
set @q = repeat('q', 256);
200
 
 
201
 
set sql_mode = '';
202
 
 
203
 
insert into t1 values(@c, @c, @c);
204
 
insert into t2 values(@c);
205
 
insert into t1 values(@q, @q, @q);
206
 
insert into t2 values(@q);
207
 
 
208
 
set sql_mode = 'traditional';
209
 
 
210
 
insert into t1 values(@c, @c, @c);
211
 
--error 1406
212
 
insert into t2 values(@c);
213
 
--error 1406
214
 
insert into t1 values(@q, NULL, NULL);
215
 
--error 1406
216
 
insert into t1 values(NULL, @q, NULL);
217
 
--error 1406
218
 
insert into t1 values(NULL, NULL, @q);
219
 
--error 1406
220
 
insert into t2 values(@q);
221
 
 
222
 
drop table t1, t2;
223
 
 
224
 
--echo End of 5.0 tests