summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-05-14 18:38:49 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-05-15 15:13:06 +0530
commitd49233caf696ba5896ff9119ca1a07039368ab23 (patch)
treeedd6eb2c15f39f5436f7ad00580879d41ea7d1c9 /sql/item_sum.cc
parent1408e26d0b15ea95d3d017bb059cd65b53b00a86 (diff)
downloadmariadb-git-d49233caf696ba5896ff9119ca1a07039368ab23.tar.gz
MDEV-18100: User defined aggregate functions not working correctly when the schema is changed
The issue here was that when the schema was changed the value for the THD::server_status is ored with SERVER_SESSION_STATE_CHANGED. For custom aggregate functions, currently we check if the server_status is equal to SERVER_STATUS_LAST_ROW_SENT then we should terminate the execution of the custom aggregate function as there are no more rows to fetch. So the check should be that if the server status has the bit set for SERVER_STATUS_LAST_ROW_SENT then we should terminate the execution of the custom aggregate function.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 91b75b776e2..d843e87fa03 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1384,10 +1384,12 @@ Item_sum_sp::execute()
bool res;
uint old_server_status= thd->server_status;
- /* We set server status so we can send a signal to exit from the
- function with the return value. */
+ /*
+ We set server status so we can send a signal to exit from the
+ function with the return value.
+ */
- thd->server_status= SERVER_STATUS_LAST_ROW_SENT;
+ thd->server_status|= SERVER_STATUS_LAST_ROW_SENT;
res= Item_sp::execute(thd, &null_value, args, arg_count);
thd->server_status= old_server_status;
return res;