← Back to team overview

maria-developers team mailing list archive

Please review a fix for MDEV-10780 (and likely for MDEV-10806 and MDEV-10910)

 

Hello Sanja, Elena, Wlad,

Sanja, please review a patch for MDEV-10780.

The patch is for 10.1. I could not reproduce it in 10.0.
But it should be safe to push it into 10.0 anyway.

This patch is most likely fixing MDEV-10806 (assigned to Sanja)
and MDEV-10910 (assigned to Elena).

Thanks!
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index 685b534..7b8bb84 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -234,5 +234,15 @@ SELECT * FROM t1 WHERE DEFAULT(b);
 a	b
 DROP TABLE IF EXISTS t1;
 #
+# MDEV-10780 Server crashes in in create_tmp_table
+#
+CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ();
+INSERT INTO t1 VALUES ();
+SELECT DISTINCT DEFAULT (pk) FROM t1 GROUP BY RAND() WITH ROLLUP;
+DEFAULT (pk)
+0
+DROP TABLE t1;
+#
 # End of 10.1 tests
 #
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 17f4383..a5a0e18 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -181,5 +181,19 @@ DROP TABLE IF EXISTS t1;
 
 
 --echo #
+--echo # MDEV-10780 Server crashes in in create_tmp_table
+--echo #
+
+--connect (con1,127.0.0.1,root,,test)
+CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ();
+INSERT INTO t1 VALUES ();
+SELECT DISTINCT DEFAULT (pk) FROM t1 GROUP BY RAND() WITH ROLLUP;
+--disconnect con1
+--connection default
+DROP TABLE t1;
+
+
+--echo #
 --echo # End of 10.1 tests
 --echo #
diff --git a/sql/item.h b/sql/item.h
index 1905e0f..638ef74 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -4822,6 +4822,9 @@ class Item_default_value : public Item_field
   int save_in_field(Field *field_arg, bool no_conversions);
   table_map used_tables() const { return (table_map)0L; }
 
+  Field *get_tmp_table_field() { return 0; }
+  Item *get_tmp_table_item(THD *thd) { return this; }
+
   bool walk(Item_processor processor, bool walk_subquery, uchar *args)
   {
     return (arg && arg->walk(processor, walk_subquery, args)) ||

Follow ups