mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql UDF without temporary table created
The server crashed when SPIDER_DIRECT_SQL UDF was called with
non-existing temporary table.
The bug has been introduced by 91ffdc8
. The commit removed
the check, from THD::open_temporary_table(), which ensure that
the target temporary tables exist.
We can fix the bug by adding the check before the call of
THD::open_temporary_table().
This commit is contained in:
parent
a1b0f23586
commit
1fda0544b9
4 changed files with 44 additions and 0 deletions
18
storage/spider/mysql-test/spider/bugfix/r/mdev_25684.result
Normal file
18
storage/spider/mysql-test/spider/bugfix/r/mdev_25684.result
Normal file
|
@ -0,0 +1,18 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
|
||||
MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql UDF without temporary table created
|
||||
|
||||
connection master_1;
|
||||
SELECT SPIDER_DIRECT_SQL('SELECT * FROM s', 'non_existing_temporary_table', 'srv "s_2_1"');
|
||||
ERROR HY000: Temporary table 'test.non_existing_temporary_table' is not found
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
3
storage/spider/mysql-test/spider/bugfix/t/mdev_25684.cnf
Normal file
3
storage/spider/mysql-test/spider/bugfix/t/mdev_25684.cnf
Normal file
|
@ -0,0 +1,3 @@
|
|||
!include include/default_mysqld.cnf
|
||||
!include ../my_1_1.cnf
|
||||
!include ../my_2_1.cnf
|
19
storage/spider/mysql-test/spider/bugfix/t/mdev_25684.test
Normal file
19
storage/spider/mysql-test/spider/bugfix/t/mdev_25684.test
Normal file
|
@ -0,0 +1,19 @@
|
|||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
--echo
|
||||
--echo MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql UDF without temporary table created
|
||||
--echo
|
||||
|
||||
--connection master_1
|
||||
--error 12703
|
||||
SELECT SPIDER_DIRECT_SQL('SELECT * FROM s', 'non_existing_temporary_table', 'srv "s_2_1"');
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
|
@ -3818,6 +3818,10 @@ TABLE *spider_find_temporary_table(
|
|||
) {
|
||||
DBUG_ENTER("spider_find_temporary_table");
|
||||
#ifdef SPIDER_open_temporary_table
|
||||
if (!thd->has_temporary_tables())
|
||||
{
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
if (thd->open_temporary_table(table_list))
|
||||
{
|
||||
DBUG_RETURN(NULL);
|
||||
|
|
Loading…
Reference in a new issue