diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index d055511a50aff4a5b01197131343fd97bd74b972..5920c87d20a045e4c9fb8b7c9f47be970a029fb2 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -1,13 +1,24 @@ -drop table if exists t1; +drop table if exists t1, t2; Warnings: Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' create table t1 (a int); insert into t1 values (1); insert into t1 values ("hej"); +Warnings: +Warning 1263 Data truncated for column 'a' at row 1 insert into t1 values ("hej"),("då"); +Warnings: +Warning 1263 Data truncated for column 'a' at row 1 +Warning 1263 Data truncated for column 'a' at row 2 set SQL_WARNINGS=1; insert into t1 values ("hej"); +Warnings: +Warning 1263 Data truncated for column 'a' at row 1 insert into t1 values ("hej"),("då"); +Warnings: +Warning 1263 Data truncated for column 'a' at row 1 +Warning 1263 Data truncated for column 'a' at row 2 drop table t1; set SQL_WARNINGS=0; drop temporary table if exists not_exists; @@ -31,10 +42,77 @@ select @@warning_count; @@warning_count 0 drop table t1; +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 ','; +Warnings: +Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 +Warning 1263 Data truncated for column 'd' at row 3 +Warning 1263 Data truncated for column 'c' at row 4 +Warning 1259 Record count is fewer than the column count at row 5 +Warning 1263 Data truncated for column 'b' at row 6 +Warning 1260 Record count is more than the column count at row 7 +Warning 1262 Data truncated, out of range for column 'a' at row 8 +select @@warning_count; +@@warning_count +7 +drop table t1; +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'); +Warnings: +Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 1 +Warning 1262 Data truncated, out of range for column 'b' at row 2 +Warning 1263 Data truncated for column 'c' at row 2 +Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1262 Data truncated, out of range for column 'b' at row 3 +Warning 1263 Data truncated for column 'c' at row 3 +alter table t1 modify c char(4); +Warnings: +Warning 1263 Data truncated for column 'c' at row 1 +Warning 1263 Data truncated for column 'c' at row 2 +alter table t1 add d char(2); +update t1 set a=NULL where a=10; +Warnings: +Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 2 +update t1 set c='mysql ab' where c='test'; +Warnings: +Warning 1263 Data truncated for column 'c' at row 4 +update t1 set d=c; +Warnings: +Warning 1263 Data truncated for column 'd' at row 1 +Warning 1263 Data truncated for column 'd' at row 2 +Warning 1263 Data truncated for column 'd' at row 3 +Warning 1263 Data truncated for column 'd' at row 4 +create table t2(a tinyint NOT NULL, b char(3)); +insert into t2 select b,c from t1; +Warnings: +Warning 1263 Data truncated for column 'b' at row 1 +Warning 1263 Data truncated for column 'b' at row 2 +Warning 1263 Data truncated for column 'b' at row 3 +Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 +Warning 1263 Data truncated for column 'b' at row 4 +drop table t1, t2; +create table t1(a char(10)); +alter table t1 add b char; +set max_error_count=10; +update t1 set b=a; +Warnings: +Warning 1263 Data truncated for column 'b' at row 1 +Warning 1263 Data truncated for column 'b' at row 2 +Warning 1263 Data truncated for column 'b' at row 3 +Warning 1263 Data truncated for column 'b' at row 4 +Warning 1263 Data truncated for column 'b' at row 5 +Warning 1263 Data truncated for column 'b' at row 6 +Warning 1263 Data truncated for column 'b' at row 7 +Warning 1263 Data truncated for column 'b' at row 8 +Warning 1263 Data truncated for column 'b' at row 9 +Warning 1263 Data truncated for column 'b' at row 10 +select @@warning_count; +@@warning_count +50 create table t1 (id int) type=isam; Warnings: -Warning 1259 Using storage engine MYISAM for table 't1' +Warning 1264 Using storage engine MYISAM for table 't1' alter table t1 type=isam; Warnings: -Warning 1259 Using storage engine MYISAM for table 't1' +Warning 1264 Using storage engine MYISAM for table 't1' drop table t1; diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index ab8c0b99ca54ed6561ebe77b482bf7036b5f95ad..16a9b5d11e66315f13a8fdb3688847d566418915 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -2,7 +2,7 @@ # Test some warnings # --disable-warnings -drop table if exists t1; +drop table if exists t1, t2; --enable-warnings create table t1 (a int); @@ -17,6 +17,7 @@ set SQL_WARNINGS=0; # # Test other warnings +# drop temporary table if exists not_exists; drop table if exists not_exists_table; @@ -28,6 +29,51 @@ create table if not exists t1(id int); select @@warning_count; drop table t1; +# +# 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; +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 +# create table t1 (id int) type=isam; alter table t1 type=isam; drop table t1; diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index cb709c45326f2b97cd962457effacb543304e094..1a6320cbee9b92604e3f799a09cded578a4fa182 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -249,16 +249,32 @@ "Reference '%-.64s' not supported (%s)", "Every derived table must have it's own alias", "Select %u was reduced during optimisation", -"Table '%-.64s' from one of SELECT's can not be used in %-.32s", -"Client does not support authentication protocol requested by server. Consider upgrading MySQL client", -"All parts of a SPATIAL KEY must be NOT NULL", -"COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", -"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", -"Z_BUF_ERROR: Not enough memory available for zlib", -"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", -"Z_DATA_ERROR: Input data was corrupted for zlib", -"%d line(s) was(were) cut by group_concat()", +"Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" +"All parts of a SPATIAL KEY must be NOT NULL" +"COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" +"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)" +"Z_BUF_ERROR: Not enough memory available for zlib" +"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)" +"Z_DATA_ERROR: Input data was corrupted for zlib" +"%d line(s) was(were) cut by group_concat()"<<<<<<< local sql/share/english/errmsg.txt 1.79 +"Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" +"All parts of a SPATIAL KEY must be NOT NULL" +"COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" +"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)" +"Z_BUF_ERROR: Not enough memory available for zlib" +"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)" +"Z_DATA_ERROR: Input data was corrupted for zlib" +"%d line(s) was(were) cut by group_concat()"; +"Record count is fewer than the column count at row %ld"; +"Record count is more than the column count at row %ld"; +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; +"Data truncated, out of range for column '%s' at row %ld"; +"Data truncated for column '%s' at row %ld" "Using storage engine %s for table '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",