mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM LAST_INSERT_ID ()
There is not current SELECT during assigning SP parameters, do not use it if current_select is empty.
This commit is contained in:
@@ -2168,6 +2168,25 @@ show status like "Qcache_hits";
|
|||||||
Variable_name Value
|
Variable_name Value
|
||||||
Qcache_hits 1
|
Qcache_hits 1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
|
||||||
|
# LAST_INSERT_ID ()
|
||||||
|
# (part 2, part 1 is in sp.test)
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 values (1);
|
||||||
|
CREATE FUNCTION foo (i INT UNSIGNED ) RETURNS int deterministic RETURN 1;
|
||||||
|
show status like "Qcache_queries_in_cache";
|
||||||
|
Variable_name Value
|
||||||
|
Qcache_queries_in_cache 0
|
||||||
|
SELECT foo( LAST_INSERT_ID() ) from t1;
|
||||||
|
foo( LAST_INSERT_ID() )
|
||||||
|
1
|
||||||
|
show status like "Qcache_queries_in_cache";
|
||||||
|
Variable_name Value
|
||||||
|
Qcache_queries_in_cache 0
|
||||||
|
DROP FUNCTION foo;
|
||||||
|
drop table t1;
|
||||||
restore defaults
|
restore defaults
|
||||||
SET GLOBAL query_cache_type= default;
|
SET GLOBAL query_cache_type= default;
|
||||||
SET GLOBAL query_cache_size= default;
|
SET GLOBAL query_cache_size= default;
|
||||||
|
@@ -8335,3 +8335,11 @@ ERROR 42S22: Unknown column 'name2' in 'field list'
|
|||||||
drop procedure p1;
|
drop procedure p1;
|
||||||
drop procedure p2;
|
drop procedure p2;
|
||||||
drop procedure p3;
|
drop procedure p3;
|
||||||
|
#
|
||||||
|
# MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
|
||||||
|
# LAST_INSERT_ID ()
|
||||||
|
# (part 1, part 2 is in query_cache.test)
|
||||||
|
#
|
||||||
|
CREATE PROCEDURE foo ( IN i INT UNSIGNED ) BEGIN END;
|
||||||
|
CALL foo( LAST_INSERT_ID() );
|
||||||
|
DROP PROCEDURE foo;
|
||||||
|
@@ -1767,6 +1767,21 @@ show status like "Qcache_inserts";
|
|||||||
show status like "Qcache_hits";
|
show status like "Qcache_hits";
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
|
||||||
|
--echo # LAST_INSERT_ID ()
|
||||||
|
--echo # (part 2, part 1 is in sp.test)
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 values (1);
|
||||||
|
CREATE FUNCTION foo (i INT UNSIGNED ) RETURNS int deterministic RETURN 1;
|
||||||
|
show status like "Qcache_queries_in_cache";
|
||||||
|
SELECT foo( LAST_INSERT_ID() ) from t1;
|
||||||
|
show status like "Qcache_queries_in_cache";
|
||||||
|
DROP FUNCTION foo;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo restore defaults
|
--echo restore defaults
|
||||||
SET GLOBAL query_cache_type= default;
|
SET GLOBAL query_cache_type= default;
|
||||||
SET GLOBAL query_cache_size= default;
|
SET GLOBAL query_cache_size= default;
|
||||||
|
@@ -9840,3 +9840,13 @@ call p3();
|
|||||||
drop procedure p1;
|
drop procedure p1;
|
||||||
drop procedure p2;
|
drop procedure p2;
|
||||||
drop procedure p3;
|
drop procedure p3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
|
||||||
|
--echo # LAST_INSERT_ID ()
|
||||||
|
--echo # (part 1, part 2 is in query_cache.test)
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE PROCEDURE foo ( IN i INT UNSIGNED ) BEGIN END;
|
||||||
|
CALL foo( LAST_INSERT_ID() );
|
||||||
|
DROP PROCEDURE foo;
|
||||||
|
@@ -2902,21 +2902,24 @@ public:
|
|||||||
{
|
{
|
||||||
safe_to_cache_query= 0;
|
safe_to_cache_query= 0;
|
||||||
|
|
||||||
/*
|
if (current_select) // initialisation SP variables has no SELECT
|
||||||
There are no sense to mark select_lex and union fields of LEX,
|
|
||||||
but we should merk all subselects as uncacheable from current till
|
|
||||||
most upper
|
|
||||||
*/
|
|
||||||
SELECT_LEX *sl;
|
|
||||||
SELECT_LEX_UNIT *un;
|
|
||||||
for (sl= current_select, un= sl->master_unit();
|
|
||||||
un != &unit;
|
|
||||||
sl= sl->outer_select(), un= sl->master_unit())
|
|
||||||
{
|
{
|
||||||
sl->uncacheable|= cause;
|
/*
|
||||||
un->uncacheable|= cause;
|
There are no sense to mark select_lex and union fields of LEX,
|
||||||
|
but we should merk all subselects as uncacheable from current till
|
||||||
|
most upper
|
||||||
|
*/
|
||||||
|
SELECT_LEX *sl;
|
||||||
|
SELECT_LEX_UNIT *un;
|
||||||
|
for (sl= current_select, un= sl->master_unit();
|
||||||
|
un != &unit;
|
||||||
|
sl= sl->outer_select(), un= sl->master_unit())
|
||||||
|
{
|
||||||
|
sl->uncacheable|= cause;
|
||||||
|
un->uncacheable|= cause;
|
||||||
|
}
|
||||||
|
select_lex.uncacheable|= cause;
|
||||||
}
|
}
|
||||||
select_lex.uncacheable|= cause;
|
|
||||||
}
|
}
|
||||||
void set_trg_event_type_for_tables();
|
void set_trg_event_type_for_tables();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user