Below is the list of changes that have just been committed into a local
5.1 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-19 15:43:19+03:00, gkodinov@stripped +4 -0
Bug #31157: crash when select+order by the avg of some field within the group by
The uncacheable flag should be set at fix_fields() stage.
Fixed by moving the flag setting to match the one in 5.1
mysql-test/r/query_cache.result@stripped, 2007-10-19 15:43:17+03:00, gkodinov@stripped +14 -0
Bug #31157: test case
mysql-test/t/query_cache.test@stripped, 2007-10-19 15:43:17+03:00, gkodinov@stripped +17 -0
Bug #31157: test case
sql/item_func.cc@stripped, 2007-10-19 15:43:17+03:00, gkodinov@stripped +8 -1
Bug #31157: The uncacheable flag should be set at
fix_fields() stage.
sql/item_func.h@stripped, 2007-10-19 15:43:17+03:00, gkodinov@stripped +1 -0
Bug #31157: The uncacheable flag should be set at
fix_fields() stage.
diff -Nrup a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
--- a/mysql-test/r/query_cache.result 2007-08-30 22:23:52 +03:00
+++ b/mysql-test/r/query_cache.result 2007-10-19 15:43:17 +03:00
@@ -1732,4 +1732,18 @@ Variable_name Value
Qcache_queries_in_cache 1
drop database db2;
drop database db3;
+CREATE TABLE t1 (a ENUM('rainbow'));
+INSERT INTO t1 VALUES (),(),(),(),();
+SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
+1
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a LONGBLOB);
+INSERT INTO t1 SET a = 'aaaa';
+INSERT INTO t1 SET a = 'aaaa';
+SELECT 1 FROM t1 GROUP BY
+(SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
+1
+1
+DROP TABLE t1;
End of 5.1 tests
diff -Nrup a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
--- a/mysql-test/t/query_cache.test 2007-09-04 21:25:48 +03:00
+++ b/mysql-test/t/query_cache.test 2007-10-19 15:43:17 +03:00
@@ -1333,4 +1333,21 @@ show status like 'Qcache_queries_in_cach
drop database db2;
drop database db3;
+#
+# Bug #31157: Crash when select+order by the avg of some field within the
+# group by
+#
+
+CREATE TABLE t1 (a ENUM('rainbow'));
+INSERT INTO t1 VALUES (),(),(),(),();
+SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
+DROP TABLE t1;
+CREATE TABLE t1 (a LONGBLOB);
+INSERT INTO t1 SET a = 'aaaa';
+INSERT INTO t1 SET a = 'aaaa';
+SELECT 1 FROM t1 GROUP BY
+ (SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
diff -Nrup a/sql/item_func.cc b/sql/item_func.cc
--- a/sql/item_func.cc 2007-10-04 15:10:54 +03:00
+++ b/sql/item_func.cc 2007-10-19 15:43:17 +03:00
@@ -3624,9 +3624,16 @@ longlong Item_func_last_insert_id::val_i
thd->first_successful_insert_id_in_prev_stmt= value;
return value;
}
- thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return thd->read_first_successful_insert_id_in_prev_stmt();
}
+
+
+bool Item_func_last_insert_id::fix_fields(THD *thd, Item **ref)
+{
+ thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
+ return Item_int_func::fix_fields(thd, ref);
+}
+
/* This function is just used to test speed of different functions */
diff -Nrup a/sql/item_func.h b/sql/item_func.h
--- a/sql/item_func.h 2007-10-09 12:37:41 +03:00
+++ b/sql/item_func.h 2007-10-19 15:43:17 +03:00
@@ -935,6 +935,7 @@ public:
if (arg_count)
max_length= args[0]->max_length;
}
+ bool fix_fields(THD *thd, Item **ref);
};
| Thread |
|---|
| • bk commit into 5.1 tree (gkodinov:1.2586) BUG#31157 | kgeorge | 19 Oct |