Skip to content

Commit 9b53d84

Browse files
author
Alexander Barkov
committed
MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field().
Removing a wrong ASSERT. Item_sum_field now uses the inherited Item::get_tmp_table_field().
1 parent d5d0c35 commit 9b53d84

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

mysql-test/r/func_group.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,15 @@ id avg cast_avg
22982298
2 9223372036854775807.0000 9223372036854775807
22992299
DROP TABLE t1;
23002300
#
2301+
# MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field()
2302+
#
2303+
CREATE TABLE t1 (i INT);
2304+
INSERT INTO t1 VALUES (1),(2);
2305+
SELECT DISTINCT VAR_POP(1) FROM t1 GROUP BY @a := 's';
2306+
VAR_POP(1)
2307+
0.0000
2308+
DROP TABLE t1;
2309+
#
23012310
# MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED)
23022311
#
23032312
CREATE TABLE t1 (id INT, a DOUBLE);

mysql-test/t/func_group.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,14 @@ SELECT id, AVG(a) AS avg, CAST(MIN(a) AS SIGNED) AS cast_min FROM t1 GROUP BY id
15811581
SELECT id, AVG(a) AS avg, CAST(AVG(a) AS SIGNED) AS cast_avg FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id;
15821582
DROP TABLE t1;
15831583

1584+
--echo #
1585+
--echo # MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field()
1586+
--echo #
1587+
CREATE TABLE t1 (i INT);
1588+
INSERT INTO t1 VALUES (1),(2);
1589+
SELECT DISTINCT VAR_POP(1) FROM t1 GROUP BY @a := 's';
1590+
DROP TABLE t1;
1591+
15841592
--echo #
15851593
--echo # MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED)
15861594
--echo #

sql/item_sum.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,6 @@ class Item_sum_field :public Item
10841084
fixed= true;
10851085
}
10861086
table_map used_tables() const { return (table_map) 1L; }
1087-
Field *get_tmp_table_field() { DBUG_ASSERT(0); return NULL; }
10881087
Field *tmp_table_field(TABLE *) { DBUG_ASSERT(0); return NULL; }
10891088
void set_result_field(Field *) { DBUG_ASSERT(0); }
10901089
void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); }

0 commit comments

Comments
 (0)