Skip to content
/ server Public

Commit 8575b07

Browse files
committed
MDEV-35288 Assertion `!is_cond()' failed in virtual longlong Item_bool_func::val_int()
Boolean function now uses val_bool to get string result (val_str())
1 parent e2c63a7 commit 8575b07

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

mysql-test/main/bool_innodb.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# MDEV-35288: Assertion `!is_cond()' failed in
3+
# virtual longlong Item_bool_func::val_int()
4+
#
5+
CREATE TABLE t (a INT) ENGINE=INNODB;
6+
SELECT SUM(a), ROWNUM() AS r FROM t HAVING r=1;
7+
SUM(a) r
8+
NULL 1
9+
DROP TABLE t;
10+
# End of 10.5 tests

mysql-test/main/bool_innodb.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--source include/have_innodb.inc
2+
3+
--echo #
4+
--echo # MDEV-35288: Assertion `!is_cond()' failed in
5+
--echo # virtual longlong Item_bool_func::val_int()
6+
--echo #
7+
8+
CREATE TABLE t (a INT) ENGINE=INNODB;
9+
SELECT SUM(a), ROWNUM() AS r FROM t HAVING r=1;
10+
11+
# Cleanup
12+
DROP TABLE t;
13+
14+
15+
--echo # End of 10.5 tests

sql/item_cmpfunc.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,16 @@ class Item_bool_func :public Item_int_func,
248248
return val_bool();
249249
}
250250
bool val_bool() override= 0;
251+
String *val_str(String *str) override final
252+
{
253+
DBUG_ASSERT(fixed());
254+
bool res= val_bool();
255+
if (null_value)
256+
return 0;
257+
258+
str->set_int(res, false, collation.collation);
259+
return str;
260+
}
251261
bool fix_length_and_dec() override { decimals=0; max_length=1; return FALSE; }
252262
decimal_digits_t decimal_precision() const override { return 1; }
253263
bool need_parentheses_in_default() override { return true; }

0 commit comments

Comments
 (0)