summaryrefslogtreecommitdiff
path: root/sql/sp_head.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/sp_head.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/sp_head.cc')
-rw-r--r--sql/sp_head.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index ba130881d68..f36650bafe9 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -4431,7 +4431,7 @@ sp_instr_agg_cfetch::execute(THD *thd, uint *nextp)
else
{
thd->spcont->pause_state= FALSE;
- if (thd->server_status == SERVER_STATUS_LAST_ROW_SENT)
+ if (thd->server_status & SERVER_STATUS_LAST_ROW_SENT)
{
my_message(ER_SP_FETCH_NO_DATA,
ER_THD(thd, ER_SP_FETCH_NO_DATA), MYF(0));