Commit 26fe3289 authored by unknown's avatar unknown

compatibility fixes


mysql-test/r/strict.result:
  fixed
mysql-test/r/view.result:
  rolled back
mysql-test/t/information_schema.test:
  fix for 2GB file size limit
mysql-test/t/ps_1general.test:
  fix for 2GB file size limit
mysql-test/t/view.test:
  fix for 2GB file size limit
sql/field.cc:
  double->int conversion troubles
  cleanup
sql/item_cmpfunc.h:
  warning fixed
sql/sql_select.cc:
  division by zero fixed
parent 2d527b72
......@@ -616,7 +616,7 @@ col1 col2
-9223372036854775808 0
9223372036854775807 18446744073709551615
-9223372036854773760 0
-9223372036854775808 1844674407370953984
9223372036854775807 1844674407370953984
-9223372036854775808 NULL
-9223372036854775808 NULL
NULL 18446744073709551615
......
......@@ -8,7 +8,7 @@ create temporary table t1 (a int, b int);
create view v1 (c) as select b+1 from t1;
ERROR HY000: View's SELECT contains a temporary table 't1'
drop table t1;
create table t1 (a int, b int) max_rows=1000000;
create table t1 (a int, b int);
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
create view v1 (c,d) as select a,b+@@global.max_user_connections from t1;
ERROR HY000: View's SELECT contains a variable or parameter
......@@ -149,7 +149,7 @@ v5 VIEW
v6 VIEW
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 9 Fixed 5 9 45 150994943 1024 0 NULL # # NULL latin1_swedish_ci NULL max_rows=1000000
t1 MyISAM 9 Fixed 5 9 45 38654705663 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
v2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
v3 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
......@@ -1213,14 +1213,14 @@ select * from v1;
drop view v1;
drop table t1;
create function x1 () returns int return 5;
create table t1 (s1 int) max_rows=1000000;
create table t1 (s1 int);
create view v1 as select x1() from t1;
drop function x1;
select * from v1;
ERROR 42000: FUNCTION test.x1 does not exist
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 9 Fixed 0 0 0 83886079 1024 0 NULL # # NULL latin1_swedish_ci NULL max_rows=1000000
t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL FUNCTION test.x1 does not exist
drop view v1;
drop table t1;
......
......@@ -41,6 +41,7 @@ show tables like 't%';
--replace_column 15 # 16 #
show tables * from test where table_name like 't%';
--replace_column 12 # 13 #
--replace_result "2147483647 " "21474836479 "
show table status;
show full columns from t3 like "a%";
show full columns from mysql.db like "Insert%";
......
......@@ -294,12 +294,14 @@ execute stmt4;
prepare stmt4 from ' show table status from test like ''t2%'' ';
# egalize date and time values
--replace_column 12 # 13 # 14 #
--replace_result 2147483647 64424509439
# Bug#4288 : prepared statement 'show table status ..', wrong output on execute
execute stmt4;
# try the same with the big table
prepare stmt4 from ' show table status from test like ''t9%'' ';
# egalize date and time values
--replace_column 12 # 13 # 14 #
--replace_result 2147483647 4294967295
# Bug#4288
execute stmt4;
prepare stmt4 from ' show status like ''Threads_running'' ';
......
......@@ -19,7 +19,7 @@ create temporary table t1 (a int, b int);
create view v1 (c) as select b+1 from t1;
drop table t1;
create table t1 (a int, b int) max_rows=1000000;
create table t1 (a int, b int);
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
# view with variable
......@@ -84,6 +84,7 @@ explain extended select c from v6;
show tables;
show full tables;
--replace_column 12 # 13 #
--replace_result 2147483647 38654705663
show table status;
drop view v1,v2,v3,v4,v5,v6;
......@@ -1165,12 +1166,13 @@ drop table t1;
# VIEW over dropped function
#
create function x1 () returns int return 5;
create table t1 (s1 int) max_rows=1000000;
create table t1 (s1 int);
create view v1 as select x1() from t1;
drop function x1;
-- error 1305
select * from v1;
--replace_column 12 # 13 #
--replace_result "2147483647 " "21474836479 "
show table status;
drop view v1;
drop table t1;
......
......@@ -1182,7 +1182,7 @@ int Field_tiny::store(double nr)
error= 1;
}
else
*ptr=(char) nr;
*ptr=(char) (int) nr;
}
return error;
}
......@@ -1313,9 +1313,9 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (tmp > (uint16) ~0)
else if (tmp > UINT_MAX16)
{
tmp=(uint16) ~0;
tmp=UINT_MAX16;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
......@@ -1364,9 +1364,9 @@ int Field_short::store(double nr)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (double) (uint16) ~0)
else if (nr > (double) UINT_MAX16)
{
res=(int16) (uint16) ~0;
res=(int16) UINT_MAX16;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
......@@ -1388,7 +1388,7 @@ int Field_short::store(double nr)
error= 1;
}
else
res=(int16) nr;
res=(int16) (int) nr;
}
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
......@@ -1413,9 +1413,9 @@ int Field_short::store(longlong nr)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
else if (nr > (longlong) (uint16) ~0)
else if (nr > (longlong) UINT_MAX16)
{
res=(int16) (uint16) ~0;
res=(int16) UINT_MAX16;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
......@@ -1884,7 +1884,7 @@ int Field_long::store(double nr)
error= 1;
}
else
res=(int32) nr;
res=(int32) (longlong) nr;
}
if (error)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
......@@ -2123,7 +2123,7 @@ int Field_longlong::store(double nr)
res=0;
error= 1;
}
else if (nr >= (double) ~ (ulonglong) 0)
else if (nr >= (double) ULONGLONG_MAX)
{
res= ~(longlong) 0;
error= 1;
......@@ -2133,15 +2133,15 @@ int Field_longlong::store(double nr)
}
else
{
if (nr < (double) LONGLONG_MIN)
if (nr <= (double) LONGLONG_MIN)
{
res= LONGLONG_MIN;
error= 1;
error= (nr < (double) LONGLONG_MIN);
}
else if (nr > (double) LONGLONG_MAX)
else if (nr >= (double) LONGLONG_MAX)
{
res= LONGLONG_MAX;
error= 1;
error= (nr > (double) LONGLONG_MAX);
}
else
res=(longlong) nr;
......
......@@ -1086,7 +1086,7 @@ class COND_EQUAL: public Sql_alloc
};
class Item_equal_iterator :List_iterator_fast<Item_field>
class Item_equal_iterator : public List_iterator_fast<Item_field>
{
public:
inline Item_equal_iterator(Item_equal &item_equal)
......
......@@ -3464,7 +3464,7 @@ best_access_path(JOIN *join,
{
/*
Assume that the first key part matches 1% of the file
and that the hole key matches 10 (duplicates) or 1
and that the whole key matches 10 (duplicates) or 1
(unique) records.
Assume also that more key matches proportionally more
records
......@@ -3472,7 +3472,7 @@ best_access_path(JOIN *join,
records = (x * (b-a) + a*c-b)/(c-1)
b = records matched by whole key
a = records matched by first key part (10% of all records?)
a = records matched by first key part (1% of all records?)
c = number of key parts in key
x = used key parts (1 <= x <= c)
*/
......@@ -3488,9 +3488,12 @@ best_access_path(JOIN *join,
else
{
double a=s->records*0.01;
tmp = (max_key_part * (rec_per_key - a) +
a*keyinfo->key_parts - rec_per_key)/
(keyinfo->key_parts-1);
if (keyinfo->key_parts > 1)
tmp= (max_key_part * (rec_per_key - a) +
a*keyinfo->key_parts - rec_per_key)/
(keyinfo->key_parts-1);
else
tmp= a;
set_if_bigger(tmp,1.0);
}
records = (ulong) tmp;
......@@ -4421,7 +4424,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
{
/*
Assume that the first key part matches 1% of the file
and that the hole key matches 10 (duplicates) or 1
and that the whole key matches 10 (duplicates) or 1
(unique) records.
Assume also that more key matches proportionally more
records
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment