mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#47736 killing a select from a view when the view is processing a function, asserts
hide_view_error() does not take into account that thread query may be killed. Added a check for thd->killed. Addon: backported bug32140 fix from 6.0
This commit is contained in:
@ -268,6 +268,17 @@ SELECT RELEASE_LOCK('Bug44521');
|
|||||||
RELEASE_LOCK('Bug44521')
|
RELEASE_LOCK('Bug44521')
|
||||||
1
|
1
|
||||||
DROP PROCEDURE p;
|
DROP PROCEDURE p;
|
||||||
|
CREATE TABLE t1(a int);
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60);
|
||||||
|
CREATE VIEW v1 AS SELECT f1('a') FROM t1;
|
||||||
|
SELECT * FROM v1;;
|
||||||
|
SELECT * FROM v1;
|
||||||
|
ERROR 70100: Query execution was interrupted
|
||||||
|
ERROR 70100: Query execution was interrupted
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP FUNCTION f1;
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# -- End of 5.1 tests
|
# -- End of 5.1 tests
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
@ -413,6 +413,43 @@ let $wait_condition=
|
|||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
DROP PROCEDURE p;
|
DROP PROCEDURE p;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#47736 killing a select from a view when the view is processing a function, asserts
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a int);
|
||||||
|
INSERT INTO t1 VALUES (1);
|
||||||
|
CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60);
|
||||||
|
CREATE VIEW v1 AS SELECT f1('a') FROM t1;
|
||||||
|
|
||||||
|
--connect (con1, localhost, root,,)
|
||||||
|
--let $ID_1= `SELECT connection_id()`
|
||||||
|
--send SELECT * FROM v1;
|
||||||
|
|
||||||
|
--connect (con2, localhost, root,,)
|
||||||
|
--let $ID_2= `SELECT connection_id()`
|
||||||
|
--send SELECT * FROM v1
|
||||||
|
|
||||||
|
--connection default
|
||||||
|
--disable_query_log
|
||||||
|
--eval KILL QUERY $ID_2
|
||||||
|
--eval KILL QUERY $ID_1
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
--connection con1
|
||||||
|
--error ER_QUERY_INTERRUPTED
|
||||||
|
--reap
|
||||||
|
--connection con2
|
||||||
|
--error ER_QUERY_INTERRUPTED
|
||||||
|
--reap
|
||||||
|
|
||||||
|
--connection default
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP FUNCTION f1;
|
||||||
|
--disconnect con1
|
||||||
|
--disconnect con2
|
||||||
|
|
||||||
|
|
||||||
--echo # ------------------------------------------------------------------
|
--echo # ------------------------------------------------------------------
|
||||||
--echo # -- End of 5.1 tests
|
--echo # -- End of 5.1 tests
|
||||||
--echo # ------------------------------------------------------------------
|
--echo # ------------------------------------------------------------------
|
||||||
|
@ -1898,6 +1898,10 @@ sp_cache_routines_and_add_tables_aux(THD *thd, LEX *lex,
|
|||||||
ret= SP_OK;
|
ret= SP_OK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
/* Query might have been killed, don't set error. */
|
||||||
|
if (thd->killed)
|
||||||
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Any error when loading an existing routine is either some problem
|
Any error when loading an existing routine is either some problem
|
||||||
with the mysql.proc table, or a parse error because the contents
|
with the mysql.proc table, or a parse error because the contents
|
||||||
|
@ -3365,7 +3365,7 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type)
|
|||||||
|
|
||||||
void TABLE_LIST::hide_view_error(THD *thd)
|
void TABLE_LIST::hide_view_error(THD *thd)
|
||||||
{
|
{
|
||||||
if (thd->get_internal_handler())
|
if (thd->killed || thd->get_internal_handler())
|
||||||
return;
|
return;
|
||||||
/* Hide "Unknown column" or "Unknown function" error */
|
/* Hide "Unknown column" or "Unknown function" error */
|
||||||
DBUG_ASSERT(thd->is_error());
|
DBUG_ASSERT(thd->is_error());
|
||||||
|
Reference in New Issue
Block a user