diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-11-01 13:22:34 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-11-01 13:22:34 +0100 |
commit | 1a3859fff09986a8ffc7b1b466ef565ce2b0bf42 (patch) | |
tree | 35ea5463ef5b7503028816d377e7d2b4e77bdd1f | |
parent | 29633dc0c0c49f27ad3c9a405f4730fbfef4bbb0 (diff) | |
download | mariadb-git-1a3859fff09986a8ffc7b1b466ef565ce2b0bf42.tar.gz |
MDEV-29924 Assertion `(((nr) % (1LL << 24)) % (int) log_10_int[6 - dec]) == 0' failed in my_time_packed_to_binary on SELECT when using TIME field
when assigning the cached item to the Item_cache for the first time
make sure to use Item_cache::setup(), not Item_cache::store().
Because the former copies the metadata (and allocates memory, in case
of Item_cache_row), and Item_cache::decimal must be set for
comparisons to work correctly.
-rw-r--r-- | mysql-test/main/type_time_hires.result | 13 | ||||
-rw-r--r-- | mysql-test/main/type_time_hires.test | 15 | ||||
-rw-r--r-- | sql/sql_class.cc | 4 |
3 files changed, 28 insertions, 4 deletions
diff --git a/mysql-test/main/type_time_hires.result b/mysql-test/main/type_time_hires.result index 5fa9d11591a..cf7dce59f1f 100644 --- a/mysql-test/main/type_time_hires.result +++ b/mysql-test/main/type_time_hires.result @@ -360,7 +360,7 @@ select cast(1e-6 as time(6)); cast(1e-6 as time(6)) 00:00:00.000001 # -# Start of 10.4 tests +# End of 5.5 tests # # # MDEV-20397 Support TIMESTAMP, DATETIME, TIME in ROUND() and TRUNCATE() @@ -907,3 +907,14 @@ a CEILING(a) CEILING_SP(a) CEILING(a)=CEILING_SP(a) DROP FUNCTION FLOOR_SP; DROP FUNCTION CEILING_SP; DROP TABLE t1; +# +# MDEV-29924 Assertion `(((nr) % (1LL << 24)) % (int) log_10_int[6 - dec]) == 0' failed in my_time_packed_to_binary on SELECT when using TIME field +# +create table t1 (c decimal(3,1),d time(6)); +insert into t1 values (null,0.1),(null,0.1), (0.1,0.2); +select c from t1 where c<all (select d from t1); +c +drop table t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/type_time_hires.test b/mysql-test/main/type_time_hires.test index f9b4a5a9f27..51824c689ad 100644 --- a/mysql-test/main/type_time_hires.test +++ b/mysql-test/main/type_time_hires.test @@ -11,9 +11,8 @@ drop table t1; select cast(1e-6 as time(6)); - --echo # ---echo # Start of 10.4 tests +--echo # End of 5.5 tests --echo # --echo # @@ -196,3 +195,15 @@ DROP FUNCTION FLOOR_SP; DROP FUNCTION CEILING_SP; DROP TABLE t1; + +--echo # +--echo # MDEV-29924 Assertion `(((nr) % (1LL << 24)) % (int) log_10_int[6 - dec]) == 0' failed in my_time_packed_to_binary on SELECT when using TIME field +--echo # +create table t1 (c decimal(3,1),d time(6)); +insert into t1 values (null,0.1),(null,0.1), (0.1,0.2); +select c from t1 where c<all (select d from t1); +drop table t1; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/sql/sql_class.cc b/sql/sql_class.cc index be96fdda0f0..10bee9e7aae 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3753,8 +3753,10 @@ int select_max_min_finder_subselect::send_data(List<Item> &items) { cache= val_item->get_cache(thd); set_op(val_item->type_handler()); + cache->setup(thd, val_item); } - cache->store(val_item); + else + cache->store(val_item); it->store(0, cache); } it->assigned(1); |