Commit c76c4206 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Test of optimize table.

parent 7a45e7f2
This diff is collapsed.
...@@ -68,3 +68,12 @@ select * from t2 where b="world"; ...@@ -68,3 +68,12 @@ select * from t2 where b="world";
a B a B
3 world 3 world
drop table t1,t2; drop table t1,t2;
create table t1(x varchar(50) );
create table t2 select x from t1 where 1=2;
describe t1;
Field Type Null Key Default Extra
x varchar(50) YES NULL
describe t2;
Field Type Null Key Default Extra
x char(50) YES NULL
drop table t1,t2;
...@@ -31,3 +31,20 @@ check table t1; ...@@ -31,3 +31,20 @@ check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
drop table t1; drop table t1;
create table t1 (a int not null auto_increment, b int not null, primary key (a), index(b));
insert into t1 (b) values (1),(2),(2),(2),(2);
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
t1 0 PRIMARY 1 a A 5 NULL NULL
t1 1 b 1 b A 1 NULL NULL
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
t1 0 PRIMARY 1 a A 5 NULL NULL
t1 1 b 1 b A 1 NULL NULL
drop table t1;
...@@ -65,3 +65,13 @@ create table t2 (key (b)) select * from t1; ...@@ -65,3 +65,13 @@ create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world"; explain select * from t2 where b="world";
select * from t2 where b="world"; select * from t2 where b="world";
drop table t1,t2; drop table t1,t2;
#
# Test types after CREATE ... SELECT
#
create table t1(x varchar(50) );
create table t2 select x from t1 where 1=2;
describe t1;
describe t2;
drop table t1,t2;
...@@ -621,8 +621,8 @@ double Item_func_rand::val() ...@@ -621,8 +621,8 @@ double Item_func_rand::val()
{ {
if (arg_count) if (arg_count)
{ // Only use argument once in query { // Only use argument once in query
ulong tmp=((ulong) args[0]->val_int())+55555555L; ulong tmp=((ulong) args[0]->val_int());
randominit(&current_thd->rand,tmp,tmp/2); randominit(&current_thd->rand,tmp*0x10001L+55555555L,tmp*0x10000001L);
#ifdef DELETE_ITEMS #ifdef DELETE_ITEMS
delete args[0]; delete args[0];
#endif #endif
......
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