summaryrefslogtreecommitdiff
path: root/mysql-test/main/explain.test
diff options
context:
space:
mode:
authorSergei Petrunia <sergey@mariadb.com>2022-12-22 15:49:10 +0300
committerSergei Petrunia <sergey@mariadb.com>2023-01-04 16:50:12 +0300
commit0bef50e50b59ea1d85fea027f45cc51ca74e4074 (patch)
treeb358f442e3e4a48a443a7cf732ab2a37bbac04d6 /mysql-test/main/explain.test
parent5db970fc760d4cfebdff236ba5bb382f0419b9f1 (diff)
downloadmariadb-git-bb-10.4-mdev20501-v2.tar.gz
MDEV-20501: Assertion `maybe_null || !null_value' failed in Item_func_round::date_opbb-10.4-mdev20501-v2
When the optimizer finds a constant (or system) table $TBL which is empty or has no matching row, it would set table->null_row=true. This is done even for tables with table->maybe_null==0. Then, it would proceed to perform query optimization phases (what for?) which will attempt to evaluate Item expressions referring to $TBL. Eventually some Item expression will get the value of $TBL.not_null_field, get SQL NULL and fail an assertion. Fixed by not performing any query optimization steps after we've got constant/empty tables with no matching rows. Test result changes contain a lot of changes like - ... Impossible WHERE noticed after reading const tables + ... no matching row in const table as well as other changes caused by slightly-different processing of the special case of empty constant tables.
Diffstat (limited to 'mysql-test/main/explain.test')
-rw-r--r--mysql-test/main/explain.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/main/explain.test b/mysql-test/main/explain.test
index 0c31f94f8f9..245b10e183c 100644
--- a/mysql-test/main/explain.test
+++ b/mysql-test/main/explain.test
@@ -370,3 +370,23 @@ drop table t1;
explain
VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3));
+
+--echo #
+--echo # MDEV-20501: Assertion `maybe_null || !null_value' failed in Item_func_round::date_op
+--echo #
+
+CREATE TABLE t1 (t TIMESTAMP NOT NULL) ENGINE=MyISAM;
+SELECT * FROM t1 WHERE TRUNCATE( t, 1 );
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-26536: Assertion `maybe_null() || !null_value' failed in Item_func_ceiling::time_op
+--echo #
+CREATE TABLE t1 (a INT,b TIME NOT NULL DEFAULT 1) ENGINE=MyISAM;
+SELECT b FROM t1 GROUP BY b HAVING CEILING (b)>0;
+drop table t1;
+
+create table t1 (b time not null ) engine=myisam;
+select floor(b) as f from t1 group by b having f=1;
+drop table t1;
+