MDEV-17963: Assertion field_pos < field_count' failed in Protocol_text::store, Assertion
field_handlers == 0 || field_pos < field_count'
The problem was that sp_head::MULTI_RESULTS was not set correctly for ANALYZE statement with SELECT ... INTO variable. This is a follow up fix for MDEV-7023
This commit is contained in:
parent
838bb9fad4
commit
fd08f95322
@ -8319,4 +8319,18 @@ UNION
|
||||
SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.PARAMETERS;
|
||||
DROP FUNCTION f;
|
||||
DROP VIEW v;
|
||||
#
|
||||
# MDEV-17963: Assertion `field_pos < field_count' failed in Protocol_text::store,
|
||||
# Assertion `field_handlers == 0 || field_pos < field_count'
|
||||
#
|
||||
CREATE TABLE t1 (ct time);
|
||||
INSERT INTO t1 VALUES ('16:11:28');
|
||||
CREATE FUNCTION f1 () RETURNS varchar(100)
|
||||
BEGIN
|
||||
DECLARE xxx varchar(100);
|
||||
ANALYZE SELECT sum(ct) FROM t1 INTO xxx ;
|
||||
RETURN xxx;
|
||||
END|
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
drop table t1;
|
||||
#End of 10.1 tests
|
||||
|
@ -9840,4 +9840,24 @@ SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.PARAMETERS;
|
||||
DROP FUNCTION f;
|
||||
DROP VIEW v;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17963: Assertion `field_pos < field_count' failed in Protocol_text::store,
|
||||
--echo # Assertion `field_handlers == 0 || field_pos < field_count'
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (ct time);
|
||||
INSERT INTO t1 VALUES ('16:11:28');
|
||||
|
||||
DELIMITER |;
|
||||
--error ER_SP_NO_RETSET
|
||||
CREATE FUNCTION f1 () RETURNS varchar(100)
|
||||
BEGIN
|
||||
DECLARE xxx varchar(100);
|
||||
ANALYZE SELECT sum(ct) FROM t1 INTO xxx ;
|
||||
RETURN xxx;
|
||||
END|
|
||||
|
||||
DELIMITER ;|
|
||||
drop table t1;
|
||||
|
||||
--echo #End of 10.1 tests
|
||||
|
@ -212,7 +212,7 @@ sp_get_flags_for_command(LEX *lex)
|
||||
|
||||
switch (lex->sql_command) {
|
||||
case SQLCOM_SELECT:
|
||||
if (lex->result)
|
||||
if (lex->result && !lex->analyze_stmt)
|
||||
{
|
||||
flags= 0; /* This is a SELECT with INTO clause */
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user