summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormalff/marcsql@weblab.(none) <>2007-03-01 19:20:47 -0700
committermalff/marcsql@weblab.(none) <>2007-03-01 19:20:47 -0700
commitad45f0168d425b5b85cab1d3a0205dc1916042dd (patch)
treefb41290501675c692d9aba10ea4b0d9b579b017f /sql
parent4e556b230585efc62d45da66d628db1be1ac24aa (diff)
downloadmariadb-git-ad45f0168d425b5b85cab1d3a0205dc1916042dd.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.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc4
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