mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
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: Bug #31157: test case mysql-test/t/query_cache.test: Bug #31157: test case sql/item_func.cc: Bug #31157: The uncacheable flag should be set at fix_fields() stage. sql/item_func.h: Bug #31157: The uncacheable flag should be set at fix_fields() stage.
This commit is contained in:
@ -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
|
||||
|
@ -1333,4 +1333,21 @@ show status like 'Qcache_queries_in_cache';
|
||||
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
|
||||
|
Reference in New Issue
Block a user