1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

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.
This commit is contained in:
Oleksandr Byelkin
2015-01-29 12:47:13 +01:00
parent 0b049b4012
commit 51feb6fa99
3 changed files with 123 additions and 3 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;