Skip to content

Commit

Permalink
MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field().
Browse files Browse the repository at this point in the history
Removing a wrong ASSERT. Item_sum_field now uses the inherited
Item::get_tmp_table_field().
  • Loading branch information
Alexander Barkov committed Mar 16, 2016
1 parent d5d0c35 commit 9b53d84
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions mysql-test/r/func_group.result
Original file line number Diff line number Diff line change
Expand Up @@ -2298,6 +2298,15 @@ id avg cast_avg
2 9223372036854775807.0000 9223372036854775807
DROP TABLE t1;
#
# MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field()
#
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
SELECT DISTINCT VAR_POP(1) FROM t1 GROUP BY @a := 's';
VAR_POP(1)
0.0000
DROP TABLE t1;
#
# MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED)
#
CREATE TABLE t1 (id INT, a DOUBLE);
Expand Down
8 changes: 8 additions & 0 deletions mysql-test/t/func_group.test
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,14 @@ SELECT id, AVG(a) AS avg, CAST(MIN(a) AS SIGNED) AS cast_min FROM t1 GROUP BY id
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;
DROP TABLE t1;

--echo #
--echo # MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field()
--echo #
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
SELECT DISTINCT VAR_POP(1) FROM t1 GROUP BY @a := 's';
DROP TABLE t1;

--echo #
--echo # MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED)
--echo #
Expand Down
1 change: 0 additions & 1 deletion sql/item_sum.h
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,6 @@ class Item_sum_field :public Item
fixed= true;
}
table_map used_tables() const { return (table_map) 1L; }
Field *get_tmp_table_field() { DBUG_ASSERT(0); return NULL; }
Field *tmp_table_field(TABLE *) { DBUG_ASSERT(0); return NULL; }
void set_result_field(Field *) { DBUG_ASSERT(0); }
void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); }
Expand Down

0 comments on commit 9b53d84

Please sign in to comment.