warnings.test 2.04 KB
Newer Older
1 2 3
#
# Test some warnings
#
4
--disable_warnings
venu@myvenu.com's avatar
venu@myvenu.com committed
5
drop table if exists t1, t2;
6
--enable_warnings
monty@mashka.mysql.fi's avatar
monty@mashka.mysql.fi committed
7
SET SQL_WARNINGS=1;
8

9 10 11 12 13 14 15 16 17
create table t1 (a int);
insert into t1 values (1);
insert into t1 values ("hej");
insert into t1 values ("hej"),("d");
set SQL_WARNINGS=1;
insert into t1 values ("hej");
insert into t1 values ("hej"),("d");
drop table t1;
set SQL_WARNINGS=0;
18 19 20

#
# Test other warnings
venu@myvenu.com's avatar
venu@myvenu.com committed
21
#
22 23

drop temporary table if exists not_exists;
24 25 26 27 28 29 30
drop table if exists not_exists_table;
show warnings limit 1;
drop database if exists not_exists_db;
show count(*) warnings;
create table t1(id int);
create table if not exists t1(id int);
select @@warning_count;
31 32
drop table t1;

venu@myvenu.com's avatar
venu@myvenu.com committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#
# Test warnings for LOAD DATA INFILE
#

create table t1(a tinyint, b int not null, c date, d char(5));
load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
select @@warning_count;
drop table t1;

#
# Warnings from basic INSERT, UPDATE and ALTER commands
#

create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
alter table t1 modify c char(4);
alter table t1 add d char(2);
update t1 set a=NULL where a=10;
update t1 set c='mysql ab' where c='test';
update t1 set d=c;
create table t2(a tinyint NOT NULL, b char(3));
insert into t2 select b,c from t1;
55
insert into t2(b) values('mysqlab');
56 57 58
set sql_warnings=1;
insert into t2(b) values('mysqlab');
set sql_warnings=0;
venu@myvenu.com's avatar
venu@myvenu.com committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
drop table t1, t2;

#
# Test for max_error_count
#

create table t1(a char(10));
let $1=50;
disable_query_log;
while ($1)
{
  eval insert into t1 values('mysql ab');
  dec $1;
}
enable_query_log;
alter table t1 add b char;
set max_error_count=10;
update t1 set b=a;
select @@warning_count;

#
# Test for handler type
#
82
drop table t1;
83 84
create table t1 (id int) engine=isam;
alter table t1 engine=isam;
85
drop table t1;
86 87 88 89 90 91 92 93

#
# Test for deprecated TYPE= syntax
#
create table t1 (id int) type=heap;
alter table t1 type=myisam;
drop table t1;

94 95 96 97 98
#
# Test for deprecated table_type variable
#
set table_type=MYISAM;