summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-08-23 15:54:07 +0200
committerSergei Golubchik <serg@mariadb.org>2021-08-26 23:39:52 +0200
commit0860b17ef3128f4bc9e39c26f8502cafc3f4cae4 (patch)
tree42f739b472eba141df92af0a5482b086c7002272
parent0299ec29d4af3230741a62d5443c0562269b05b2 (diff)
downloadmariadb-git-0860b17ef3128f4bc9e39c26f8502cafc3f4cae4.tar.gz
MDEV-26452 SIGSEGV in Item::cleanup from Item::cleanup_processor
-rw-r--r--mysql-test/main/count_distinct.result14
-rw-r--r--mysql-test/main/count_distinct.test21
-rw-r--r--sql/item.h4
3 files changed, 30 insertions, 9 deletions
diff --git a/mysql-test/main/count_distinct.result b/mysql-test/main/count_distinct.result
index 760b2710586..037674aa66a 100644
--- a/mysql-test/main/count_distinct.result
+++ b/mysql-test/main/count_distinct.result
@@ -1,4 +1,3 @@
-drop table if exists t1,t2,t3;
create table t1 (libname varchar(21) not null, city text, primary key (libname));
create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn));
create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname));
@@ -131,3 +130,16 @@ count(distinct a)
10
drop table t1;
set @@tmp_table_size = default;
+#
+# End of 5.5 tests
+#
+#
+# MDEV-26452 SIGSEGV in Item::cleanup from Item::cleanup_processor
+#
+create table t (a int,b date,primary key(a,b));
+select b,count(distinct a) from t group by b having b is null;
+b count(distinct a)
+drop table t;
+#
+# End of 10.7 tests
+#
diff --git a/mysql-test/main/count_distinct.test b/mysql-test/main/count_distinct.test
index 86045e862e7..9f682af3d63 100644
--- a/mysql-test/main/count_distinct.test
+++ b/mysql-test/main/count_distinct.test
@@ -2,10 +2,6 @@
# Problem with count(distinct)
#
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
create table t1 (libname varchar(21) not null, city text, primary key (libname));
create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn));
create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname));
@@ -149,6 +145,17 @@ select count(distinct a) from t1;
drop table t1;
set @@tmp_table_size = default;
-#
-# End of 5.5 tests
-#
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-26452 SIGSEGV in Item::cleanup from Item::cleanup_processor
+--echo #
+create table t (a int,b date,primary key(a,b));
+select b,count(distinct a) from t group by b having b is null;
+drop table t;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #
diff --git a/sql/item.h b/sql/item.h
index 82c42edfe17..8f955302c9c 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2647,7 +2647,7 @@ public:
bool depends_only_on(table_map view_map)
{ return marker & MARKER_FULL_EXTRACTION; }
- int get_extraction_flag()
+ int get_extraction_flag() const
{ return marker & MARKER_EXTRACTION_MASK; }
void set_extraction_flag(int16 flags)
{
@@ -4433,6 +4433,8 @@ public:
virtual void top_level_item() override {}
void set_join_tab_idx(uint8 join_tab_idx_arg) override
{ DBUG_ASSERT(0); }
+
+ void cleanup() override {}
};
/* The following variablese are stored in a read only segment */