mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-14623: Output of show function code does not show FETCH GROUP NEXT ROW for custom aggregates
The print() function was missing from the FETCH GROUP NEXT ROW instrunction class, so there was no output for this particular instruction when we use the query SHOW FUNCTION CODE function_name
This commit is contained in:
@ -1301,3 +1301,24 @@ Pos Instruction
|
|||||||
28 jump 4
|
28 jump 4
|
||||||
29 cpop 1
|
29 cpop 1
|
||||||
DROP PROCEDURE p1;
|
DROP PROCEDURE p1;
|
||||||
|
#
|
||||||
|
# MDEV-14623: Output of show function code does not show FETCH GROUP NEXT ROW
|
||||||
|
# for custom aggregates
|
||||||
|
#
|
||||||
|
create aggregate function f1(x INT) returns int
|
||||||
|
begin
|
||||||
|
declare continue handler for not found return 0;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
insert into t2 (sal) values (x);
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
show function code f1;
|
||||||
|
Pos Instruction
|
||||||
|
0 hpush_jump 2 1 CONTINUE
|
||||||
|
1 freturn int 0
|
||||||
|
2 agg_cfetch
|
||||||
|
3 stmt 5 "insert into t2 (sal) values (x)"
|
||||||
|
4 jump 2
|
||||||
|
5 hpop 1
|
||||||
|
drop function f1;
|
||||||
|
@ -927,3 +927,22 @@ $$
|
|||||||
DELIMITER ;$$
|
DELIMITER ;$$
|
||||||
SHOW PROCEDURE CODE p1;
|
SHOW PROCEDURE CODE p1;
|
||||||
DROP PROCEDURE p1;
|
DROP PROCEDURE p1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-14623: Output of show function code does not show FETCH GROUP NEXT ROW
|
||||||
|
--echo # for custom aggregates
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
delimiter |;
|
||||||
|
create aggregate function f1(x INT) returns int
|
||||||
|
begin
|
||||||
|
declare continue handler for not found return 0;
|
||||||
|
loop
|
||||||
|
fetch group next row;
|
||||||
|
insert into t2 (sal) values (x);
|
||||||
|
end loop;
|
||||||
|
end|
|
||||||
|
|
||||||
|
delimiter ;|
|
||||||
|
show function code f1;
|
||||||
|
drop function f1;
|
||||||
|
@ -4409,7 +4409,7 @@ sp_instr_cfetch::print(String *str)
|
|||||||
int
|
int
|
||||||
sp_instr_agg_cfetch::execute(THD *thd, uint *nextp)
|
sp_instr_agg_cfetch::execute(THD *thd, uint *nextp)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("sp_instr_cfetch::execute");
|
DBUG_ENTER("sp_instr_agg_cfetch::execute");
|
||||||
int res= 0;
|
int res= 0;
|
||||||
if (!thd->spcont->instr_ptr)
|
if (!thd->spcont->instr_ptr)
|
||||||
{
|
{
|
||||||
@ -4434,7 +4434,16 @@ sp_instr_agg_cfetch::execute(THD *thd, uint *nextp)
|
|||||||
DBUG_RETURN(res);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_instr_agg_cfetch::print(String *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint rsrv= SP_INSTR_UINT_MAXLEN+11;
|
||||||
|
|
||||||
|
if (str->reserve(rsrv))
|
||||||
|
return;
|
||||||
|
str->qs_append(STRING_WITH_LEN("agg_cfetch"));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sp_instr_cursor_copy_struct class functions
|
sp_instr_cursor_copy_struct class functions
|
||||||
|
@ -1957,7 +1957,7 @@ public:
|
|||||||
|
|
||||||
virtual int execute(THD *thd, uint *nextp);
|
virtual int execute(THD *thd, uint *nextp);
|
||||||
|
|
||||||
virtual void print(String *str){};
|
virtual void print(String *str);
|
||||||
}; // class sp_instr_agg_cfetch : public sp_instr
|
}; // class sp_instr_agg_cfetch : public sp_instr
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user