diff options
author | unknown <malff/marcsql@weblab.(none)> | 2007-03-01 19:20:47 -0700 |
---|---|---|
committer | unknown <malff/marcsql@weblab.(none)> | 2007-03-01 19:20:47 -0700 |
commit | 0a93be2869be5eb801d7955ad512504190dd0479 (patch) | |
tree | fb41290501675c692d9aba10ea4b0d9b579b017f /sql | |
parent | a475ed7c6b6607272afb87517ae6ab1f3a397f41 (diff) | |
download | mariadb-git-0a93be2869be5eb801d7955ad512504190dd0479.tar.gz |
Bug#26093 (SELECT BENCHMARK() for SELECT statements does not produce valid
results)
Before this fix, the function BENCHMARK() would fail to evaluate expressions
like "(select avg(a) from t1)" in debug builds (with an assert),
or would report a time of zero in non debug builds.
The root cause is that evaluation of DECIMAL_RESULT expressions was not
supported in Item_func_benchmark::val_int().
This has been fixed by this change.
mysql-test/r/func_misc.result:
Added support for DECIMAL_RESULT in Item_func_benchmark::val_int()
mysql-test/t/func_misc.test:
Added support for DECIMAL_RESULT in Item_func_benchmark::val_int()
sql/item_func.cc:
Added support for DECIMAL_RESULT in Item_func_benchmark::val_int()
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 1ef77208469..1538d0ed390 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3456,6 +3456,7 @@ longlong Item_func_benchmark::val_int() DBUG_ASSERT(fixed == 1); char buff[MAX_FIELD_WIDTH]; String tmp(buff,sizeof(buff), &my_charset_bin); + my_decimal tmp_decimal; THD *thd=current_thd; for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++) @@ -3470,6 +3471,9 @@ longlong Item_func_benchmark::val_int() case STRING_RESULT: (void) args[0]->val_str(&tmp); break; + case DECIMAL_RESULT: + (void) args[0]->val_decimal(&tmp_decimal); + break; case ROW_RESULT: default: // This case should never be chosen |