diff options
author | unknown <monty@mysql.com> | 2004-12-06 19:18:35 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-12-06 19:18:35 +0200 |
commit | 8379b61efb053da778846416baf23812a26e8f86 (patch) | |
tree | 44698f6f68c51daacf7552356ae071b8e8fdb035 /mysql-test/t/heap.test | |
parent | 19a95482195a158425c66ac629d07da53e4fc1b6 (diff) | |
parent | a8ea31fae6737c453d2dd9719a75f905c06048b3 (diff) | |
download | mariadb-git-8379b61efb053da778846416baf23812a26e8f86.tar.gz |
Merge with new VARCHAR code
configure.in:
Auto merged
BitKeeper/deleted/.del-acinclude.m4~f4ab416bac5003:
Auto merged
BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e:
Auto merged
BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e:
Auto merged
client/mysqldump.c:
Auto merged
client/mysqltest.c:
Auto merged
heap/hp_create.c:
Auto merged
heap/hp_delete.c:
Auto merged
heap/hp_hash.c:
Auto merged
heap/hp_write.c:
Auto merged
include/decimal.h:
Auto merged
include/m_ctype.h:
Auto merged
libmysql/libmysql.c:
Auto merged
libmysqld/Makefile.am:
Auto merged
myisam/mi_check.c:
Auto merged
myisam/mi_create.c:
Auto merged
myisam/mi_write.c:
Auto merged
mysql-test/r/ctype_tis620.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/myisam.result:
Auto merged
mysql-test/r/mysqldump.result:
Auto merged
mysql-test/r/order_by.result:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/r/ps_1general.result:
Auto merged
mysql-test/r/ps_2myisam.result:
Auto merged
mysql-test/r/ps_3innodb.result:
Auto merged
mysql-test/r/ps_4heap.result:
Auto merged
mysql-test/r/ps_5merge.result:
Auto merged
mysql-test/r/ps_6bdb.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/strict.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/type_blob.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
mysql-test/t/endspace.test:
Auto merged
mysql-test/t/myisam.test:
Auto merged
mysql-test/t/ps_1general.test:
Auto merged
mysql-test/t/strict.test:
Auto merged
mysql-test/t/type_blob.test:
Auto merged
ndb/src/common/util/NdbSqlUtil.cpp:
Auto merged
scripts/mysql_fix_privilege_tables.sh:
Auto merged
sql/field.h:
Auto merged
sql/field_conv.cc:
Auto merged
sql/ha_heap.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/opt_sum.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_help.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/structs.h:
Auto merged
sql/table.cc:
Auto merged
strings/ctype-czech.c:
Auto merged
strings/ctype-uca.c:
Auto merged
strings/ctype-utf8.c:
Auto merged
strings/ctype-win1250ch.c:
Auto merged
strings/decimal.c:
Auto merged
tests/client_test.c:
Auto merged
mysql-test/r/bdb.result:
Merge with VARCHAR code
mysql-test/r/heap.result:
Merge with VARCHAR code
mysql-test/r/innodb.result:
Merge with VARCHAR code
mysql-test/r/select.result.es:
Merge with VARCHAR code
mysql-test/t/bdb.test:
Merge with VARCHAR code
mysql-test/t/heap.test:
Merge with VARCHAR code
mysql-test/t/innodb.test:
Merge with VARCHAR code
sql/field.cc:
Merge with VARCHAR code
sql/item.cc:
Merge with VARCHAR code
sql/sql_acl.cc:
Merge with VARCHAR code
sql/sql_parse.cc:
Merge with VARCHAR code
sql/sql_table.cc:
Merge with VARCHAR code
sql/sql_update.cc:
Merge with VARCHAR code
sql/table.h:
Merge with VARCHAR code
strings/ctype-mb.c:
Don't pad my_like_range with max_str for simple LIKE expression
strings/ctype-tis620.c:
Merge with VARCHAR code
strings/ctype-ucs2.c:
Added new argument to my_strnncollsp_ucs2()
Simply code
Diffstat (limited to 'mysql-test/t/heap.test')
-rw-r--r-- | mysql-test/t/heap.test | 213 |
1 files changed, 212 insertions, 1 deletions
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index bc0b28370ec..cabcba3e98c 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -3,7 +3,7 @@ # --disable_warnings -drop table if exists t1; +drop table if exists t1,t2,t3; --enable_warnings create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; @@ -195,3 +195,214 @@ delete from t1 where a is null; insert into t1 values ('2'), ('3'); select * from t1; drop table t1; + +# +# Test varchar +# We can't use varchar.inc becasue heap doesn't support blob's +# + +let $default=`select @@storage_engine`; +set storage_engine=HEAP; + +# +# Simple basic test that endspace is saved +# + +create table t1 (v varchar(10), c char(10), t varchar(50)); +insert into t1 values('+ ', '+ ', '+ '); +set @a=repeat(' ',20); +insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); +select concat('*',v,'*',c,'*',t,'*') from t1; + +# Check how columns are copied +show create table t1; +create table t2 like t1; +show create table t2; +create table t3 select * from t1; +show create table t3; +alter table t1 modify c varchar(10); +show create table t1; +alter table t1 modify v char(10); +show create table t1; +alter table t1 modify t varchar(10); +show create table t1; +select concat('*',v,'*',c,'*',t,'*') from t1; +drop table t1,t2,t3; + +# +# Testing of keys +# +create table t1 (v varchar(10), c char(10), t varchar(50), key(v), key(c), key(t(10))); +show create table t1; +disable_query_log; +let $1=10; +while ($1) +{ + let $2=27; + eval set @space=repeat(' ',10-$1); + while ($2) + { + eval set @char=char(ascii('a')+$2-1); + insert into t1 values(concat(@char,@space),concat(@char,@space),concat(@char,@space)); + dec $2; + } + dec $1; +} +enable_query_log; +select count(*) from t1; +insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1))); +select count(*) from t1 where v='a'; +select count(*) from t1 where c='a'; +select count(*) from t1 where t='a'; +select count(*) from t1 where v='a '; +select count(*) from t1 where c='a '; +select count(*) from t1 where t='a '; +select count(*) from t1 where v between 'a' and 'a '; +select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +select count(*) from t1 where v like 'a%'; +select count(*) from t1 where c like 'a%'; +select count(*) from t1 where t like 'a%'; +select count(*) from t1 where v like 'a %'; +explain select count(*) from t1 where v='a '; +explain select count(*) from t1 where c='a '; +explain select count(*) from t1 where t='a '; +explain select count(*) from t1 where v like 'a%'; +explain select count(*) from t1 where v between 'a' and 'a '; +explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; + +--error 1062 +alter table t1 add unique(v); +alter table t1 add key(v); +select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; +explain select * from t1 where v='a'; + +# GROUP BY + +select v,count(*) from t1 group by v limit 10; +select v,count(t) from t1 group by v limit 10; +select v,count(c) from t1 group by v limit 10; +select sql_big_result v,count(t) from t1 group by v limit 10; +select sql_big_result v,count(c) from t1 group by v limit 10; +select c,count(*) from t1 group by c limit 10; +select c,count(t) from t1 group by c limit 10; +select sql_big_result c,count(t) from t1 group by c limit 10; +select t,count(*) from t1 group by t limit 10; +select t,count(t) from t1 group by t limit 10; +select sql_big_result t,count(t) from t1 group by t limit 10; +drop table t1; + +# +# Test unique keys +# + +create table t1 (a char(10), unique (a)); +insert into t1 values ('a'); +--error 1062 +insert into t1 values ('a '); + +alter table t1 modify a varchar(10); +--error 1062 +insert into t1 values ('a '),('a '),('a '),('a '); +--error 1062 +insert into t1 values ('a '); +--error 1062 +insert into t1 values ('a '); +--error 1062 +insert into t1 values ('a '); +update t1 set a='a ' where a like 'a '; +update t1 set a='a ' where a like 'a '; +drop table t1; + +# +# Testing of btree keys +# + +create table t1 (v varchar(10), c char(10), t varchar(50), key using btree (v), key using btree (c), key using btree (t(10))); +show create table t1; +disable_query_log; +let $1=10; +while ($1) +{ + let $2=27; + eval set @space=repeat(' ',10-$1); + while ($2) + { + eval set @char=char(ascii('a')+$2-1); + insert into t1 values(concat(@char,@space),concat(@char,@space),concat(@char,@space)); + dec $2; + } + dec $1; +} +enable_query_log; +select count(*) from t1; +insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1))); +select count(*) from t1 where v='a'; +select count(*) from t1 where c='a'; +select count(*) from t1 where t='a'; +select count(*) from t1 where v='a '; +select count(*) from t1 where c='a '; +select count(*) from t1 where t='a '; +select count(*) from t1 where v between 'a' and 'a '; +--replace_column 9 # +select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +--replace_column 9 # +explain select count(*) from t1 where v='a '; +--replace_column 9 # +explain select count(*) from t1 where c='a '; +--replace_column 9 # +explain select count(*) from t1 where t='a '; +--replace_column 9 # +explain select count(*) from t1 where v like 'a%'; +--replace_column 9 # +explain select count(*) from t1 where v between 'a' and 'a '; +--replace_column 9 # +explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; + +--error 1062 +alter table t1 add unique(v); +alter table t1 add key(v); +select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; +explain select * from t1 where v='a'; + +drop table t1; + +# +# Test unique btree keys +# + +create table t1 (a char(10), unique using btree (a)) engine=heap; +insert into t1 values ('a'); +--error 1062 +insert into t1 values ('a '); + +alter table t1 modify a varchar(10); +--error 1062 +insert into t1 values ('a '),('a '),('a '),('a '); +--error 1062 +insert into t1 values ('a '); +--error 1062 +insert into t1 values ('a '); +--error 1062 +insert into t1 values ('a '); +update t1 set a='a ' where a like 'a '; +update t1 set a='a ' where a like 'a '; +drop table t1; + +# +# test show create table +# + +create table t1 (v varchar(10), c char(10), t varchar(50), key(v(5)), key(c(5)), key(t(5))); +show create table t1; +drop table t1; + +create table t1 (v varchar(65530), key(v(10))); +show create table t1; +insert into t1 values(repeat('a',65530)); +select length(v) from t1 where v=repeat('a',65530); +drop table t1; + +# +# Reset varchar test +# +eval set storage_engine=$default; |