Commit 51feb6fa authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-7023: Error 2027: Malformed packet and assertion `field_types == 0 ||...

MDEV-7023: Error 2027: Malformed packet and assertion `field_types == 0 || field_types[field_pos] == MYSQL_TYPE_INT24 || field_types[field_pos] == MYSQL_TYPE_LONG' failure in Protocol_text::store_long

The problem was that sp_head::MULTI_RESULTS was not set correctly for ANALYZE statement.
parent 0b049b40
......@@ -7880,3 +7880,60 @@ DECLARE f2 VARCHAR(64) COLLATE latin1_german2_ci;
RETURN 'str';
END|
DROP FUNCTION f|
#
# MDEV-7023: Error 2027: Malformed packet and assertion
# `field_types == 0 || field_types[field_pos] == MYSQL_TYPE_INT24 ||
#field_types[field_pos] == MYSQL_TYPE_LONG' failure in
#Protocol_text::store_long
#
create table t1 (i int);
create table t2 (i int);
create function f() returns int
begin
analyze insert into t1 values (1);
return 1;
end |
ERROR 0A000: Not allowed to return a result set from a function
create function f() returns int
begin
analyze insert t1 select * from t2;
return 1;
end |
ERROR 0A000: Not allowed to return a result set from a function
create function f() returns int
begin
analyze delete from t1;
return 1;
end |
ERROR 0A000: Not allowed to return a result set from a function
create function f() returns int
begin
analyze delete t1 from t1,t2;
return 1;
end |
ERROR 0A000: Not allowed to return a result set from a function
create function f() returns int
begin
analyze update t1 set i=1;
return 1;
end |
ERROR 0A000: Not allowed to return a result set from a function
create function f() returns int
begin
analyze update t1,t2 set i=1;
return 1;
end |
ERROR 0A000: Not allowed to return a result set from a function
create function f() returns int
begin
analyze replace t1 set i=1;
return 1;
end |
ERROR 0A000: Not allowed to return a result set from a function
create function f() returns int
begin
analyze replace t1 select * from t2;
return 1;
end |
ERROR 0A000: Not allowed to return a result set from a function
drop table t1,t2;
......@@ -9324,3 +9324,64 @@ BEGIN
END|
DROP FUNCTION f|
DELIMITER ;|
--echo #
--echo # MDEV-7023: Error 2027: Malformed packet and assertion
--echo # `field_types == 0 || field_types[field_pos] == MYSQL_TYPE_INT24 ||
--echo #field_types[field_pos] == MYSQL_TYPE_LONG' failure in
--echo #Protocol_text::store_long
--echo #
create table t1 (i int);
create table t2 (i int);
--delimiter |
--error ER_SP_NO_RETSET
create function f() returns int
begin
analyze insert into t1 values (1);
return 1;
end |
--error ER_SP_NO_RETSET
create function f() returns int
begin
analyze insert t1 select * from t2;
return 1;
end |
--error ER_SP_NO_RETSET
create function f() returns int
begin
analyze delete from t1;
return 1;
end |
--error ER_SP_NO_RETSET
create function f() returns int
begin
analyze delete t1 from t1,t2;
return 1;
end |
--error ER_SP_NO_RETSET
create function f() returns int
begin
analyze update t1 set i=1;
return 1;
end |
--error ER_SP_NO_RETSET
create function f() returns int
begin
analyze update t1,t2 set i=1;
return 1;
end |
--error ER_SP_NO_RETSET
create function f() returns int
begin
analyze replace t1 set i=1;
return 1;
end |
--error ER_SP_NO_RETSET
create function f() returns int
begin
analyze replace t1 select * from t2;
return 1;
end |
--delimiter ;
drop table t1,t2;
......@@ -341,11 +341,13 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_DELETE_MULTI:
{
/*
DELETE normally doesn't return resultset, but there are two exceptions:
DELETE normally doesn't return resultset, but there are 3 exceptions:
- DELETE ... RETURNING
- EXPLAIN DELETE ...
- ANALYZE DELETE ...
*/
if (lex->select_lex.item_list.is_empty() && !lex->describe)
if (lex->select_lex.item_list.is_empty() &&
!lex->describe && !lex->analyze_stmt)
flags= 0;
else
flags= sp_head::MULTI_RESULTS;
......@@ -358,7 +360,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_REPLACE_SELECT:
case SQLCOM_INSERT_SELECT:
{
if (!lex->describe)
if (!lex->describe && !lex->analyze_stmt)
flags= 0;
else
flags= sp_head::MULTI_RESULTS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment