Commit 21a17536 authored by Sergei Golubchik's avatar Sergei Golubchik

5.3 merge

parents 434bbc34 63d09188
...@@ -740,7 +740,7 @@ create table t1 as select concat(uncompressed_length('')) as c1; ...@@ -740,7 +740,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varbinary(10) NOT NULL DEFAULT '' `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 as select concat(connection_id()) as c1; create table t1 as select concat(connection_id()) as c1;
......
...@@ -1132,7 +1132,7 @@ create table t1 as select concat(uncompressed_length('')) as c1; ...@@ -1132,7 +1132,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 as select concat(connection_id()) as c1; create table t1 as select concat(connection_id()) as c1;
......
...@@ -1212,7 +1212,7 @@ create table t1 as select concat(uncompressed_length('')) as c1; ...@@ -1212,7 +1212,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) NOT NULL DEFAULT '' `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 as select concat(connection_id()) as c1; create table t1 as select concat(connection_id()) as c1;
......
...@@ -2121,7 +2121,7 @@ create table t1 as select concat(uncompressed_length('')) as c1; ...@@ -2121,7 +2121,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 as select concat(connection_id()) as c1; create table t1 as select concat(connection_id()) as c1;
......
...@@ -2951,7 +2951,7 @@ create table t1 as select concat(uncompressed_length('')) as c1; ...@@ -2951,7 +2951,7 @@ create table t1 as select concat(uncompressed_length('')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 as select concat(connection_id()) as c1; create table t1 as select concat(connection_id()) as c1;
......
...@@ -127,3 +127,23 @@ NULL 825307441 ...@@ -127,3 +127,23 @@ NULL 825307441
EXPLAIN EXTENDED SELECT * FROM (SELECT UNCOMPRESSED_LENGTH(c1) FROM t1) AS s; EXPLAIN EXTENDED SELECT * FROM (SELECT UNCOMPRESSED_LENGTH(c1) FROM t1) AS s;
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
#
# Start of 5.3 tests
#
#
# MDEV-5783 Assertion `0' failed in make_sortkey(SORTPARAM*, uchar*, uchar*) on ORDER BY HEX(UNCOMPRESSED_LENGTH(pk))
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2);
SELECT UNCOMPRESSED_LENGTH(pk) FROM t1;
UNCOMPRESSED_LENGTH(pk)
NULL
NULL
Warnings:
Warning 1259 ZLIB: Input data corrupted
Warning 1259 ZLIB: Input data corrupted
SELECT * FROM t1 ORDER BY HEX(UNCOMPRESSED_LENGTH(pk));
DROP TABLE t1;
#
# End of 5.3 tests
#
...@@ -2055,6 +2055,20 @@ EXECUTE stmt; ...@@ -2055,6 +2055,20 @@ EXECUTE stmt;
a a
DROP TABLE t1, t2; DROP TABLE t1, t2;
DROP VIEW v2; DROP VIEW v2;
#
# MDEV-5811: Server crashes in best_access_path with materialization+semijoin and big_tables=ON
#
SET @tmp_mdev5811= @@big_tables;
SET big_tables = ON;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE ( t1_1.a, t1_2.a ) IN ( SELECT MAX(b), MIN(b) FROM t2 );
a a
DROP TABLE t1,t2;
SET big_tables=@tmp_mdev5811;
# End of 5.3 tests # End of 5.3 tests
# #
# MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries # MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
......
...@@ -2095,6 +2095,20 @@ EXECUTE stmt; ...@@ -2095,6 +2095,20 @@ EXECUTE stmt;
a a
DROP TABLE t1, t2; DROP TABLE t1, t2;
DROP VIEW v2; DROP VIEW v2;
#
# MDEV-5811: Server crashes in best_access_path with materialization+semijoin and big_tables=ON
#
SET @tmp_mdev5811= @@big_tables;
SET big_tables = ON;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE ( t1_1.a, t1_2.a ) IN ( SELECT MAX(b), MIN(b) FROM t2 );
a a
DROP TABLE t1,t2;
SET big_tables=@tmp_mdev5811;
# End of 5.3 tests # End of 5.3 tests
# #
# MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries # MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
......
...@@ -115,3 +115,24 @@ DROP TABLE t1; ...@@ -115,3 +115,24 @@ DROP TABLE t1;
set @@global.max_allowed_packet=default; set @@global.max_allowed_packet=default;
--enable_result_log --enable_result_log
--enable_query_log --enable_query_log
--echo #
--echo # Start of 5.3 tests
--echo #
--echo #
--echo # MDEV-5783 Assertion `0' failed in make_sortkey(SORTPARAM*, uchar*, uchar*) on ORDER BY HEX(UNCOMPRESSED_LENGTH(pk))
--echo #
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2);
SELECT UNCOMPRESSED_LENGTH(pk) FROM t1;
# ORDER is not strict, so disable results
--disable_result_log
SELECT * FROM t1 ORDER BY HEX(UNCOMPRESSED_LENGTH(pk));
--enable_result_log
DROP TABLE t1;
--echo #
--echo # End of 5.3 tests
--echo #
...@@ -1745,6 +1745,24 @@ EXECUTE stmt; ...@@ -1745,6 +1745,24 @@ EXECUTE stmt;
DROP TABLE t1, t2; DROP TABLE t1, t2;
DROP VIEW v2; DROP VIEW v2;
--echo #
--echo # MDEV-5811: Server crashes in best_access_path with materialization+semijoin and big_tables=ON
--echo #
SET @tmp_mdev5811= @@big_tables;
SET big_tables = ON;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE ( t1_1.a, t1_2.a ) IN ( SELECT MAX(b), MIN(b) FROM t2 );
DROP TABLE t1,t2;
SET big_tables=@tmp_mdev5811;
--echo # End of 5.3 tests --echo # End of 5.3 tests
......
...@@ -943,7 +943,7 @@ class Item_func_uncompressed_length : public Item_int_func ...@@ -943,7 +943,7 @@ class Item_func_uncompressed_length : public Item_int_func
public: public:
Item_func_uncompressed_length(Item *a):Item_int_func(a){} Item_func_uncompressed_length(Item *a):Item_int_func(a){}
const char *func_name() const{return "uncompressed_length";} const char *func_name() const{return "uncompressed_length";}
void fix_length_and_dec() { max_length=10; } void fix_length_and_dec() { max_length=10; maybe_null= true; }
longlong val_int(); longlong val_int();
}; };
......
...@@ -13636,7 +13636,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min() ...@@ -13636,7 +13636,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
} }
else if (result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE) else if (result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE)
result= 0; /* There is a result in any case. */ result= 0; /* There is a result in any case. */
my_afree(tmp_key_buff); my_afree(key_buf);
} }
} }
......
...@@ -15469,7 +15469,20 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, ...@@ -15469,7 +15469,20 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
keyinfo->key_length= 0; // Will compute the sum of the parts below. keyinfo->key_length= 0; // Will compute the sum of the parts below.
keyinfo->name= (char*) "distinct_key"; keyinfo->name= (char*) "distinct_key";
keyinfo->algorithm= HA_KEY_ALG_UNDEF; keyinfo->algorithm= HA_KEY_ALG_UNDEF;
keyinfo->rec_per_key=0; /*
Needed by non-merged semi-joins: SJ-Materialized table must have a valid
rec_per_key array, because it participates in join optimization. Since
the table has no data, the only statistics we can provide is "unknown",
i.e. zero values.
(For table record count, we calculate and set JOIN_TAB::found_records,
see get_delayed_table_estimates()).
*/
size_t rpk_size= keyinfo->key_parts* sizeof(keyinfo->rec_per_key[0]);
if (!(keyinfo->rec_per_key= (ulong*) alloc_root(&table->mem_root,
rpk_size)))
goto err;
bzero(keyinfo->rec_per_key, rpk_size);
/* /*
Create an extra field to hold NULL bits so that unique indexes on Create an extra field to hold NULL bits so that unique indexes on
......
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