diff options
-rw-r--r-- | mysql-test/r/func_compress.result | 20 | ||||
-rw-r--r-- | mysql-test/t/func_compress.test | 21 | ||||
-rw-r--r-- | sql/item_strfunc.h | 2 |
3 files changed, 42 insertions, 1 deletions
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 37f7c475148..105f2a53926 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -127,3 +127,23 @@ NULL 825307441 EXPLAIN EXTENDED SELECT * FROM (SELECT UNCOMPRESSED_LENGTH(c1) FROM t1) AS s; DROP TABLE t1; 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: +Error 1259 ZLIB: Input data corrupted +Error 1259 ZLIB: Input data corrupted +SELECT * FROM t1 ORDER BY HEX(UNCOMPRESSED_LENGTH(pk)); +DROP TABLE t1; +# +# End of 5.3 tests +# diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index 207f3a436d0..eaed0c88fe1 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -115,3 +115,24 @@ DROP TABLE t1; set @@global.max_allowed_packet=default; --enable_result_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 # diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index bb2fc0d9a33..9e3cb877803 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -822,7 +822,7 @@ class Item_func_uncompressed_length : public Item_int_func public: Item_func_uncompressed_length(Item *a):Item_int_func(a){} 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(); }; |