Commit f52e64cc authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.0

into serg.mylan:/usr/home/serg/Abk/mysql-5.0

parents 59c396e3 26fe3289
...@@ -616,7 +616,7 @@ col1 col2 ...@@ -616,7 +616,7 @@ col1 col2
-9223372036854775808 0 -9223372036854775808 0
9223372036854775807 18446744073709551615 9223372036854775807 18446744073709551615
-9223372036854773760 0 -9223372036854773760 0
-9223372036854775808 1844674407370953984 9223372036854775807 1844674407370953984
-9223372036854775808 NULL -9223372036854775808 NULL
-9223372036854775808 NULL -9223372036854775808 NULL
NULL 18446744073709551615 NULL 18446744073709551615
......
...@@ -8,7 +8,7 @@ create temporary table t1 (a int, b int); ...@@ -8,7 +8,7 @@ create temporary table t1 (a int, b int);
create view v1 (c) as select b+1 from t1; create view v1 (c) as select b+1 from t1;
ERROR HY000: View's SELECT contains a temporary table 't1' ERROR HY000: View's SELECT contains a temporary table 't1'
drop 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); 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; 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 ERROR HY000: View's SELECT contains a variable or parameter
...@@ -149,7 +149,7 @@ v5 VIEW ...@@ -149,7 +149,7 @@ v5 VIEW
v6 VIEW v6 VIEW
show table status; 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 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 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 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 v3 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
...@@ -1213,14 +1213,14 @@ select * from v1; ...@@ -1213,14 +1213,14 @@ select * from v1;
drop view v1; drop view v1;
drop table t1; drop table t1;
create function x1 () returns int return 5; 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; create view v1 as select x1() from t1;
drop function x1; drop function x1;
select * from v1; select * from v1;
ERROR 42000: FUNCTION test.x1 does not exist ERROR 42000: FUNCTION test.x1 does not exist
show table status; 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 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 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 view v1;
drop table t1; drop table t1;
......
...@@ -41,6 +41,7 @@ show tables like 't%'; ...@@ -41,6 +41,7 @@ show tables like 't%';
--replace_column 15 # 16 # --replace_column 15 # 16 #
show tables * from test where table_name like 't%'; show tables * from test where table_name like 't%';
--replace_column 12 # 13 # --replace_column 12 # 13 #
--replace_result "2147483647 " "21474836479 "
show table status; show table status;
show full columns from t3 like "a%"; show full columns from t3 like "a%";
show full columns from mysql.db like "Insert%"; show full columns from mysql.db like "Insert%";
......
...@@ -294,12 +294,14 @@ execute stmt4; ...@@ -294,12 +294,14 @@ execute stmt4;
prepare stmt4 from ' show table status from test like ''t2%'' '; prepare stmt4 from ' show table status from test like ''t2%'' ';
# egalize date and time values # egalize date and time values
--replace_column 12 # 13 # 14 # --replace_column 12 # 13 # 14 #
--replace_result 2147483647 64424509439
# Bug#4288 : prepared statement 'show table status ..', wrong output on execute # Bug#4288 : prepared statement 'show table status ..', wrong output on execute
execute stmt4; execute stmt4;
# try the same with the big table # try the same with the big table
prepare stmt4 from ' show table status from test like ''t9%'' '; prepare stmt4 from ' show table status from test like ''t9%'' ';
# egalize date and time values # egalize date and time values
--replace_column 12 # 13 # 14 # --replace_column 12 # 13 # 14 #
--replace_result 2147483647 4294967295
# Bug#4288 # Bug#4288
execute stmt4; execute stmt4;
prepare stmt4 from ' show status like ''Threads_running'' '; prepare stmt4 from ' show status like ''Threads_running'' ';
......
...@@ -19,7 +19,7 @@ create temporary table t1 (a int, b int); ...@@ -19,7 +19,7 @@ create temporary table t1 (a int, b int);
create view v1 (c) as select b+1 from t1; create view v1 (c) as select b+1 from t1;
drop 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); insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
# view with variable # view with variable
...@@ -84,6 +84,7 @@ explain extended select c from v6; ...@@ -84,6 +84,7 @@ explain extended select c from v6;
show tables; show tables;
show full tables; show full tables;
--replace_column 12 # 13 # --replace_column 12 # 13 #
--replace_result 2147483647 38654705663
show table status; show table status;
drop view v1,v2,v3,v4,v5,v6; drop view v1,v2,v3,v4,v5,v6;
...@@ -1165,12 +1166,13 @@ drop table t1; ...@@ -1165,12 +1166,13 @@ drop table t1;
# VIEW over dropped function # VIEW over dropped function
# #
create function x1 () returns int return 5; 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; create view v1 as select x1() from t1;
drop function x1; drop function x1;
-- error 1305 -- error 1305
select * from v1; select * from v1;
--replace_column 12 # 13 # --replace_column 12 # 13 #
--replace_result "2147483647 " "21474836479 "
show table status; show table status;
drop view v1; drop view v1;
drop table t1; drop table t1;
......
...@@ -1182,7 +1182,7 @@ int Field_tiny::store(double nr) ...@@ -1182,7 +1182,7 @@ int Field_tiny::store(double nr)
error= 1; error= 1;
} }
else else
*ptr=(char) nr; *ptr=(char) (int) nr;
} }
return error; return error;
} }
...@@ -1313,9 +1313,9 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -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); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 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); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1; error= 1;
} }
...@@ -1364,9 +1364,9 @@ int Field_short::store(double nr) ...@@ -1364,9 +1364,9 @@ int Field_short::store(double nr)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 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); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1; error= 1;
} }
...@@ -1388,7 +1388,7 @@ int Field_short::store(double nr) ...@@ -1388,7 +1388,7 @@ int Field_short::store(double nr)
error= 1; error= 1;
} }
else else
res=(int16) nr; res=(int16) (int) nr;
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->db_low_byte_first)
...@@ -1413,9 +1413,9 @@ int Field_short::store(longlong nr) ...@@ -1413,9 +1413,9 @@ int Field_short::store(longlong nr)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 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); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1; error= 1;
} }
...@@ -1884,7 +1884,7 @@ int Field_long::store(double nr) ...@@ -1884,7 +1884,7 @@ int Field_long::store(double nr)
error= 1; error= 1;
} }
else else
res=(int32) nr; res=(int32) (longlong) nr;
} }
if (error) if (error)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
...@@ -2123,7 +2123,7 @@ int Field_longlong::store(double nr) ...@@ -2123,7 +2123,7 @@ int Field_longlong::store(double nr)
res=0; res=0;
error= 1; error= 1;
} }
else if (nr >= (double) ~ (ulonglong) 0) else if (nr >= (double) ULONGLONG_MAX)
{ {
res= ~(longlong) 0; res= ~(longlong) 0;
error= 1; error= 1;
...@@ -2133,15 +2133,15 @@ int Field_longlong::store(double nr) ...@@ -2133,15 +2133,15 @@ int Field_longlong::store(double nr)
} }
else else
{ {
if (nr < (double) LONGLONG_MIN) if (nr <= (double) LONGLONG_MIN)
{ {
res= 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; res= LONGLONG_MAX;
error= 1; error= (nr > (double) LONGLONG_MAX);
} }
else else
res=(longlong) nr; res=(longlong) nr;
......
...@@ -1086,7 +1086,7 @@ class COND_EQUAL: public Sql_alloc ...@@ -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: public:
inline Item_equal_iterator(Item_equal &item_equal) inline Item_equal_iterator(Item_equal &item_equal)
......
...@@ -3464,7 +3464,7 @@ best_access_path(JOIN *join, ...@@ -3464,7 +3464,7 @@ best_access_path(JOIN *join,
{ {
/* /*
Assume that the first key part matches 1% of the file 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. (unique) records.
Assume also that more key matches proportionally more Assume also that more key matches proportionally more
records records
...@@ -3472,7 +3472,7 @@ best_access_path(JOIN *join, ...@@ -3472,7 +3472,7 @@ best_access_path(JOIN *join,
records = (x * (b-a) + a*c-b)/(c-1) records = (x * (b-a) + a*c-b)/(c-1)
b = records matched by whole key 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 c = number of key parts in key
x = used key parts (1 <= x <= c) x = used key parts (1 <= x <= c)
*/ */
...@@ -3488,9 +3488,12 @@ best_access_path(JOIN *join, ...@@ -3488,9 +3488,12 @@ best_access_path(JOIN *join,
else else
{ {
double a=s->records*0.01; double a=s->records*0.01;
tmp = (max_key_part * (rec_per_key - a) + if (keyinfo->key_parts > 1)
a*keyinfo->key_parts - rec_per_key)/ tmp= (max_key_part * (rec_per_key - a) +
(keyinfo->key_parts-1); a*keyinfo->key_parts - rec_per_key)/
(keyinfo->key_parts-1);
else
tmp= a;
set_if_bigger(tmp,1.0); set_if_bigger(tmp,1.0);
} }
records = (ulong) tmp; records = (ulong) tmp;
...@@ -4421,7 +4424,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, ...@@ -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 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. (unique) records.
Assume also that more key matches proportionally more Assume also that more key matches proportionally more
records 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