Skip to content

Commit

Permalink
MDEV-33494 fix spider init with no_zero_date global sql mode
Browse files Browse the repository at this point in the history
Like the fix for MDEV-32753 and MDEV-33242, spider init queries
creates new connections that use the global sql_mode of the existing
connection.
  • Loading branch information
mariadb-YuchenPei committed Mar 27, 2024
1 parent bf49e7c commit 9d34939
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions storage/spider/mysql-test/spider/bugfix/r/mdev_33494.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set @old_sql_mode=@@global.sql_mode;
set global sql_mode=(SELECT CONCAT (@@sql_mode,',no_zero_date'));
install soname 'ha_spider';
set global sql_mode=@old_sql_mode;
11 changes: 11 additions & 0 deletions storage/spider/mysql-test/spider/bugfix/t/mdev_33494.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This test tests spider init with global no_zero_date sql mode
set @old_sql_mode=@@global.sql_mode;
set global sql_mode=(SELECT CONCAT (@@sql_mode,',no_zero_date'));
install soname 'ha_spider';
set global sql_mode=@old_sql_mode;

--disable_query_log
--disable_result_log
--source ../../include/clean_up_spider.inc
--enable_result_log
--enable_query_log
2 changes: 1 addition & 1 deletion storage/spider/spd_init_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN(
"SET @@SQL_MODE = REPLACE(@@SQL_MODE, 'ORACLE', '');"
"SET @@SQL_MODE = REGEXP_REPLACE(@@SQL_MODE, '(ORACLE|NO_ZERO_DATE)', '');"
)},
{C_STRING_WITH_LEN(
"create table if not exists mysql.spider_xa("
Expand Down

0 comments on commit 9d34939

Please sign in to comment.