Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MDEV-24020: Trim with remove_str Fails on Spider
This patch fixes the bug that TRIM(BOTH ... FROM $str), TRIM(LEADING ... FROM $str), and TRIM(TRAILING ... FROM $str) failed with errors when executing on Spider.
- Loading branch information
1 parent
6ed4750
commit 43099af
Showing
7 changed files
with
366 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --let $MASTER_1_COMMENT_P_2_1= $MASTER_1_COMMENT_P_2_1_BACKUP | ||
| --let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP | ||
| --let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP | ||
| --let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP | ||
| --disable_warnings | ||
| --disable_query_log | ||
| --disable_result_log | ||
| --source ../t/test_deinit.inc | ||
| --enable_result_log | ||
| --enable_query_log | ||
| --enable_warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --disable_warnings | ||
| --disable_query_log | ||
| --disable_result_log | ||
| --source ../t/test_init.inc | ||
| --enable_result_log | ||
| --enable_query_log | ||
| --enable_warnings | ||
| --let $MASTER_1_COMMENT_P_2_1_BACKUP= $MASTER_1_COMMENT_P_2_1 | ||
| let $MASTER_1_COMMENT_P_2_1= | ||
| PARTITION BY LIST(a % 3) ( | ||
| PARTITION pt1 VALUES IN (0) COMMENT='srv "s_2_1", table "ta_r2"', | ||
| PARTITION pt2 VALUES IN (1) COMMENT='srv "s_2_1", table "ta_r3"', | ||
| PARTITION pt3 VALUES IN (2) COMMENT='srv "s_2_1", table "ta_r4"' | ||
| ); | ||
| --let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES | ||
| let $CHILD2_1_DROP_TABLES= | ||
| DROP TABLE IF EXISTS ta_r2 $STR_SEMICOLON | ||
| DROP TABLE IF EXISTS ta_r3 $STR_SEMICOLON | ||
| DROP TABLE IF EXISTS ta_r4; | ||
| --let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES | ||
| let $CHILD2_1_CREATE_TABLES= | ||
| CREATE TABLE ta_r2 ( | ||
| a INT, | ||
| b VARCHAR(30), | ||
| PRIMARY KEY(a) | ||
| ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON | ||
| CREATE TABLE ta_r3 ( | ||
| a INT, | ||
| b VARCHAR(30), | ||
| PRIMARY KEY(a) | ||
| ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET $STR_SEMICOLON | ||
| CREATE TABLE ta_r4 ( | ||
| a INT, | ||
| b VARCHAR(30), | ||
| PRIMARY KEY(a) | ||
| ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; | ||
| --let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES | ||
| let $CHILD2_1_SELECT_TABLES= | ||
| SELECT a, b FROM ta_r2 ORDER BY a $STR_SEMICOLON | ||
| SELECT a, b FROM ta_r3 ORDER BY a $STR_SEMICOLON | ||
| SELECT a, b FROM ta_r4 ORDER BY a; | ||
| let $CHILD2_1_SELECT_ARGUMENT1= | ||
| SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| for master_1 | ||
| for child2 | ||
| child2_1 | ||
| child2_2 | ||
| child2_3 | ||
| for child3 | ||
|
|
||
| this test is for MDEV-24020 | ||
|
|
||
| drop and create databases | ||
| connection master_1; | ||
| CREATE DATABASE auto_test_local; | ||
| USE auto_test_local; | ||
| connection child2_1; | ||
| CREATE DATABASE auto_test_remote; | ||
| USE auto_test_remote; | ||
|
|
||
| create table and insert | ||
| connection child2_1; | ||
| CHILD2_1_CREATE_TABLES | ||
| connection master_1; | ||
| CREATE TABLE tbl_a ( | ||
| a INT, | ||
| b VARCHAR(30), | ||
| PRIMARY KEY(a) | ||
| ) ENGINE=Spider PARTITION BY LIST(a % 3) ( | ||
| PARTITION pt1 VALUES IN (0) COMMENT='srv "s_2_1", table "ta_r2"', | ||
| PARTITION pt2 VALUES IN (1) COMMENT='srv "s_2_1", table "ta_r3"', | ||
| PARTITION pt3 VALUES IN (2) COMMENT='srv "s_2_1", table "ta_r4"' | ||
| ) | ||
| INSERT INTO tbl_a VALUES(10000, " abcd "); | ||
| INSERT INTO tbl_a VALUES(10001, " abcd "); | ||
| INSERT INTO tbl_a VALUES(10002, " abcd "); | ||
| INSERT INTO tbl_a VALUES(10003, "[[[abcd][["); | ||
| INSERT INTO tbl_a VALUES(10004, "[[[abcd][["); | ||
| INSERT INTO tbl_a VALUES(10005, "[[[abcd][["); | ||
| INSERT INTO tbl_a VALUES(10006, "[[[abcd]]"); | ||
| INSERT INTO tbl_a VALUES(10007, "[[[abcd]]"); | ||
| INSERT INTO tbl_a VALUES(10008, "[[[abcd]]"); | ||
| INSERT INTO tbl_a VALUES(10009, "[[[**abcd****]]"); | ||
|
|
||
| test 1 | ||
| connection master_1; | ||
| UPDATE tbl_a SET b = trim(b) WHERE a = 10000; | ||
| SELECT * FROM tbl_a WHERE a = 10000; | ||
| a b | ||
| 10000 abcd | ||
| UPDATE tbl_a SET b = ltrim(b) WHERE a = 10001; | ||
| SELECT * FROM tbl_a WHERE a = 10001; | ||
| a b | ||
| 10001 abcd | ||
| UPDATE tbl_a SET b = rtrim(b) WHERE a = 10002; | ||
| SELECT * FROM tbl_a WHERE a = 10002; | ||
| a b | ||
| 10002 abcd | ||
| UPDATE tbl_a SET b = trim(BOTH '[' FROM b) WHERE a = 10003; | ||
| SELECT * FROM tbl_a WHERE a = 10003; | ||
| a b | ||
| 10003 abcd] | ||
| UPDATE tbl_a SET b = trim(LEADING '[' FROM b) WHERE a = 10004; | ||
| SELECT * FROM tbl_a WHERE a = 10004; | ||
| a b | ||
| 10004 abcd][[ | ||
| UPDATE tbl_a SET b = trim(TRAILING '[' FROM b) WHERE a = 10005; | ||
| SELECT * FROM tbl_a WHERE a = 10005; | ||
| a b | ||
| 10005 [[[abcd] | ||
| UPDATE tbl_a SET b = trim(LEADING '[' FROM trim(TRAILING ']' FROM b)) WHERE a = 10006; | ||
| SELECT * FROM tbl_a WHERE a = 10006; | ||
| a b | ||
| 10006 abcd | ||
| UPDATE tbl_a SET b = trim(TRAILING '[' FROM trim(LEADING ']' FROM b)) WHERE a = 10007; | ||
| SELECT * FROM tbl_a WHERE a = 10007; | ||
| a b | ||
| 10007 [[[abcd]] | ||
| UPDATE tbl_a SET b = trim(TRAILING ']' FROM trim(LEADING '[' FROM b)) WHERE a = 10008; | ||
| SELECT * FROM tbl_a WHERE a = 10008; | ||
| a b | ||
| 10008 abcd | ||
| UPDATE tbl_a SET b = trim(BOTH '*' FROM trim(TRAILING ']' FROM trim(LEADING '[' FROM b))) WHERE a = 10009; | ||
| SELECT * FROM tbl_a WHERE a = 10009; | ||
| a b | ||
| 10009 abcd | ||
|
|
||
| deinit | ||
| connection master_1; | ||
| DROP DATABASE IF EXISTS auto_test_local; | ||
| connection child2_1; | ||
| DROP DATABASE IF EXISTS auto_test_remote; | ||
| for master_1 | ||
| for child2 | ||
| child2_1 | ||
| child2_2 | ||
| child2_3 | ||
| for child3 | ||
|
|
||
| end of test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| !include include/default_mysqld.cnf | ||
| !include ../my_1_1.cnf | ||
| !include ../my_2_1.cnf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| --source ../include/mdev_24020_init.inc | ||
| --echo | ||
| --echo this test is for MDEV-24020 | ||
| --echo | ||
| --echo drop and create databases | ||
|
|
||
| --connection master_1 | ||
| --disable_warnings | ||
| CREATE DATABASE auto_test_local; | ||
| USE auto_test_local; | ||
|
|
||
| --connection child2_1 | ||
| CREATE DATABASE auto_test_remote; | ||
| USE auto_test_remote; | ||
| --enable_warnings | ||
|
|
||
| --echo | ||
| --echo create table and insert | ||
|
|
||
| --connection child2_1 | ||
| --disable_query_log | ||
| --disable_ps_protocol | ||
| echo CHILD2_1_CREATE_TABLES; | ||
| eval $CHILD2_1_CREATE_TABLES; | ||
| --enable_ps_protocol | ||
| --enable_query_log | ||
|
|
||
| --connection master_1 | ||
| --disable_query_log | ||
| echo CREATE TABLE tbl_a ( | ||
| a INT, | ||
| b VARCHAR(30), | ||
| PRIMARY KEY(a) | ||
| ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; | ||
| eval CREATE TABLE tbl_a ( | ||
| a INT, | ||
| b VARCHAR(30), | ||
| PRIMARY KEY(a) | ||
| ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; | ||
| --enable_query_log | ||
| INSERT INTO tbl_a VALUES(10000, " abcd "); | ||
| INSERT INTO tbl_a VALUES(10001, " abcd "); | ||
| INSERT INTO tbl_a VALUES(10002, " abcd "); | ||
| INSERT INTO tbl_a VALUES(10003, "[[[abcd][["); | ||
| INSERT INTO tbl_a VALUES(10004, "[[[abcd][["); | ||
| INSERT INTO tbl_a VALUES(10005, "[[[abcd][["); | ||
| INSERT INTO tbl_a VALUES(10006, "[[[abcd]]"); | ||
| INSERT INTO tbl_a VALUES(10007, "[[[abcd]]"); | ||
| INSERT INTO tbl_a VALUES(10008, "[[[abcd]]"); | ||
| INSERT INTO tbl_a VALUES(10009, "[[[**abcd****]]"); | ||
|
|
||
| --echo | ||
| --echo test 1 | ||
|
|
||
| --connection master_1 | ||
| UPDATE tbl_a SET b = trim(b) WHERE a = 10000; | ||
| SELECT * FROM tbl_a WHERE a = 10000; | ||
| UPDATE tbl_a SET b = ltrim(b) WHERE a = 10001; | ||
| SELECT * FROM tbl_a WHERE a = 10001; | ||
| UPDATE tbl_a SET b = rtrim(b) WHERE a = 10002; | ||
| SELECT * FROM tbl_a WHERE a = 10002; | ||
| UPDATE tbl_a SET b = trim(BOTH '[' FROM b) WHERE a = 10003; | ||
| SELECT * FROM tbl_a WHERE a = 10003; | ||
| UPDATE tbl_a SET b = trim(LEADING '[' FROM b) WHERE a = 10004; | ||
| SELECT * FROM tbl_a WHERE a = 10004; | ||
| UPDATE tbl_a SET b = trim(TRAILING '[' FROM b) WHERE a = 10005; | ||
| SELECT * FROM tbl_a WHERE a = 10005; | ||
| UPDATE tbl_a SET b = trim(LEADING '[' FROM trim(TRAILING ']' FROM b)) WHERE a = 10006; | ||
| SELECT * FROM tbl_a WHERE a = 10006; | ||
| UPDATE tbl_a SET b = trim(TRAILING '[' FROM trim(LEADING ']' FROM b)) WHERE a = 10007; | ||
| SELECT * FROM tbl_a WHERE a = 10007; | ||
| UPDATE tbl_a SET b = trim(TRAILING ']' FROM trim(LEADING '[' FROM b)) WHERE a = 10008; | ||
| SELECT * FROM tbl_a WHERE a = 10008; | ||
| UPDATE tbl_a SET b = trim(BOTH '*' FROM trim(TRAILING ']' FROM trim(LEADING '[' FROM b))) WHERE a = 10009; | ||
| SELECT * FROM tbl_a WHERE a = 10009; | ||
|
|
||
| --echo | ||
| --echo deinit | ||
| --disable_warnings | ||
|
|
||
| --connection master_1 | ||
| DROP DATABASE IF EXISTS auto_test_local; | ||
|
|
||
| --connection child2_1 | ||
| DROP DATABASE IF EXISTS auto_test_remote; | ||
|
|
||
| --enable_warnings | ||
| --source ../include/mdev_24020_deinit.inc | ||
| --echo | ||
| --echo end of test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters