Loading mysql-test/r/information_schema.result +14 −0 Original line number Diff line number Diff line Loading @@ -759,6 +759,7 @@ select table_schema,table_name, column_name from information_schema.columns where data_type = 'longtext'; table_schema table_name column_name information_schema COLUMNS COLUMN_DEFAULT information_schema COLUMNS COLUMN_TYPE information_schema EVENTS EVENT_DEFINITION information_schema EVENTS SQL_MODE Loading Loading @@ -1315,6 +1316,19 @@ WHERE table_name=(SELECT MAX(table_name) FROM information_schema.tables); table_name VIEWS DROP TABLE IF EXISTS bug23037; DROP FUNCTION IF EXISTS get_value; SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; COLUMN_NAME MD5(COLUMN_DEFAULT) LENGTH(COLUMN_DEFAULT) fld1 7cf7a6782be951a1f2464a350da926a5 65532 SELECT MD5(get_value()); MD5(get_value()) 7cf7a6782be951a1f2464a350da926a5 SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=get_value() FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; COLUMN_NAME MD5(COLUMN_DEFAULT) LENGTH(COLUMN_DEFAULT) COLUMN_DEFAULT=get_value() fld1 7cf7a6782be951a1f2464a350da926a5 65532 1 DROP TABLE bug23037; DROP FUNCTION get_value; End of 5.0 tests. select * from information_schema.engines WHERE ENGINE="MyISAM"; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS Loading mysql-test/r/range.result +10 −0 Original line number Diff line number Diff line Loading @@ -665,6 +665,16 @@ OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635)) pk1 pk2 pk3 pk4 filler 2621 2635 1000015 0 filler drop table t1, t2; create table t1(a char(2), key(a(1))); insert into t1 values ('x'), ('xx'); explain select a from t1 where a > 'x'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 2 NULL 2 Using where select a from t1 where a > 'x'; a xx drop table t1; End of 4.1 tests CREATE TABLE t1 ( id int(11) NOT NULL auto_increment, status varchar(20), Loading mysql-test/t/information_schema.test +39 −0 Original line number Diff line number Diff line Loading @@ -934,7 +934,46 @@ SELECT MAX(table_name) FROM information_schema.tables; SELECT table_name from information_schema.tables WHERE table_name=(SELECT MAX(table_name) FROM information_schema.tables); # # Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table" # # Note, MyISAM/InnoDB can't take more that 65532 chars, because the row # size is limited to 65535 bytes (BLOBs not counted) # --disable_warnings DROP TABLE IF EXISTS bug23037; DROP FUNCTION IF EXISTS get_value; --enable_warnings --disable_query_log DELIMITER |; CREATE FUNCTION get_value() RETURNS TEXT DETERMINISTIC BEGIN DECLARE col1, col2, col3, col4, col6 CHAR(255); DECLARE default_val VARCHAR(65532); DECLARE done INT DEFAULT 0; DECLARE cur1 CURSOR FOR SHOW COLUMNS FROM bug23037; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; OPEN cur1; FETCH cur1 INTO col1, col2, col3, col4, default_val, col6; CLOSE cur1; RETURN default_val; end| DELIMITER ;| let $body=`SELECT REPEAT('A', 65532)`; eval CREATE TABLE bug23037(fld1 VARCHAR(65532) CHARACTER SET latin1 DEFAULT "$body"); --enable_query_log SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; SELECT MD5(get_value()); SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=get_value() FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; DROP TABLE bug23037; DROP FUNCTION get_value; --echo End of 5.0 tests. # # Show engines Loading mysql-test/t/range.test +11 −1 Original line number Diff line number Diff line Loading @@ -515,7 +515,17 @@ OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635)) ) AND (pk3 >=1000000); drop table t1, t2; # End of 4.1 tests # # Bug #20732: Partial index and long sjis search with '>' fails sometimes # create table t1(a char(2), key(a(1))); insert into t1 values ('x'), ('xx'); explain select a from t1 where a > 'x'; select a from t1 where a > 'x'; drop table t1; --echo End of 4.1 tests # # Test for optimization request #10561: to use keys for Loading sql/opt_range.cc +5 −1 Original line number Diff line number Diff line Loading @@ -2101,6 +2101,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, key_parts->null_bit= key_part_info->null_bit; key_parts->image_type = (key_info->flags & HA_SPATIAL) ? Field::itMBR : Field::itRAW; key_parts->flag= key_part_info->key_part_flag; } param.real_keynr[param.keys++]=idx; } Loading Loading @@ -5655,7 +5656,9 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, } break; case Item_func::GT_FUNC: if (field_is_equal_to_item(field,value)) /* Don't use open ranges for partial key_segments */ if (field_is_equal_to_item(field,value) && !(key_part->flag & HA_PART_KEY_SEG)) tree->min_flag=NEAR_MIN; /* fall through */ case Item_func::GE_FUNC: Loading Loading @@ -7644,6 +7647,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, key_part->length= key_info->key_part[part].length; key_part->store_length= key_info->key_part[part].store_length; key_part->null_bit= key_info->key_part[part].null_bit; key_part->flag= key_info->key_part[part].key_part_flag; } if (insert_dynamic(&quick->ranges,(gptr)&range)) goto err; Loading Loading
mysql-test/r/information_schema.result +14 −0 Original line number Diff line number Diff line Loading @@ -759,6 +759,7 @@ select table_schema,table_name, column_name from information_schema.columns where data_type = 'longtext'; table_schema table_name column_name information_schema COLUMNS COLUMN_DEFAULT information_schema COLUMNS COLUMN_TYPE information_schema EVENTS EVENT_DEFINITION information_schema EVENTS SQL_MODE Loading Loading @@ -1315,6 +1316,19 @@ WHERE table_name=(SELECT MAX(table_name) FROM information_schema.tables); table_name VIEWS DROP TABLE IF EXISTS bug23037; DROP FUNCTION IF EXISTS get_value; SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; COLUMN_NAME MD5(COLUMN_DEFAULT) LENGTH(COLUMN_DEFAULT) fld1 7cf7a6782be951a1f2464a350da926a5 65532 SELECT MD5(get_value()); MD5(get_value()) 7cf7a6782be951a1f2464a350da926a5 SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=get_value() FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; COLUMN_NAME MD5(COLUMN_DEFAULT) LENGTH(COLUMN_DEFAULT) COLUMN_DEFAULT=get_value() fld1 7cf7a6782be951a1f2464a350da926a5 65532 1 DROP TABLE bug23037; DROP FUNCTION get_value; End of 5.0 tests. select * from information_schema.engines WHERE ENGINE="MyISAM"; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS Loading
mysql-test/r/range.result +10 −0 Original line number Diff line number Diff line Loading @@ -665,6 +665,16 @@ OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635)) pk1 pk2 pk3 pk4 filler 2621 2635 1000015 0 filler drop table t1, t2; create table t1(a char(2), key(a(1))); insert into t1 values ('x'), ('xx'); explain select a from t1 where a > 'x'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 2 NULL 2 Using where select a from t1 where a > 'x'; a xx drop table t1; End of 4.1 tests CREATE TABLE t1 ( id int(11) NOT NULL auto_increment, status varchar(20), Loading
mysql-test/t/information_schema.test +39 −0 Original line number Diff line number Diff line Loading @@ -934,7 +934,46 @@ SELECT MAX(table_name) FROM information_schema.tables; SELECT table_name from information_schema.tables WHERE table_name=(SELECT MAX(table_name) FROM information_schema.tables); # # Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table" # # Note, MyISAM/InnoDB can't take more that 65532 chars, because the row # size is limited to 65535 bytes (BLOBs not counted) # --disable_warnings DROP TABLE IF EXISTS bug23037; DROP FUNCTION IF EXISTS get_value; --enable_warnings --disable_query_log DELIMITER |; CREATE FUNCTION get_value() RETURNS TEXT DETERMINISTIC BEGIN DECLARE col1, col2, col3, col4, col6 CHAR(255); DECLARE default_val VARCHAR(65532); DECLARE done INT DEFAULT 0; DECLARE cur1 CURSOR FOR SHOW COLUMNS FROM bug23037; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; OPEN cur1; FETCH cur1 INTO col1, col2, col3, col4, default_val, col6; CLOSE cur1; RETURN default_val; end| DELIMITER ;| let $body=`SELECT REPEAT('A', 65532)`; eval CREATE TABLE bug23037(fld1 VARCHAR(65532) CHARACTER SET latin1 DEFAULT "$body"); --enable_query_log SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; SELECT MD5(get_value()); SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=get_value() FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; DROP TABLE bug23037; DROP FUNCTION get_value; --echo End of 5.0 tests. # # Show engines Loading
mysql-test/t/range.test +11 −1 Original line number Diff line number Diff line Loading @@ -515,7 +515,17 @@ OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635)) ) AND (pk3 >=1000000); drop table t1, t2; # End of 4.1 tests # # Bug #20732: Partial index and long sjis search with '>' fails sometimes # create table t1(a char(2), key(a(1))); insert into t1 values ('x'), ('xx'); explain select a from t1 where a > 'x'; select a from t1 where a > 'x'; drop table t1; --echo End of 4.1 tests # # Test for optimization request #10561: to use keys for Loading
sql/opt_range.cc +5 −1 Original line number Diff line number Diff line Loading @@ -2101,6 +2101,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, key_parts->null_bit= key_part_info->null_bit; key_parts->image_type = (key_info->flags & HA_SPATIAL) ? Field::itMBR : Field::itRAW; key_parts->flag= key_part_info->key_part_flag; } param.real_keynr[param.keys++]=idx; } Loading Loading @@ -5655,7 +5656,9 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, } break; case Item_func::GT_FUNC: if (field_is_equal_to_item(field,value)) /* Don't use open ranges for partial key_segments */ if (field_is_equal_to_item(field,value) && !(key_part->flag & HA_PART_KEY_SEG)) tree->min_flag=NEAR_MIN; /* fall through */ case Item_func::GE_FUNC: Loading Loading @@ -7644,6 +7647,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table, key_part->length= key_info->key_part[part].length; key_part->store_length= key_info->key_part[part].store_length; key_part->null_bit= key_info->key_part[part].null_bit; key_part->flag= key_info->key_part[part].key_part_flag; } if (insert_dynamic(&quick->ranges,(gptr)&range)) goto err; Loading