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-24343 Spider Left join failed Unknown column 't0.ID' in 'on clause'
The Spider mixes the comma join with other join types, and thus ERROR 1054 occurs. This is well-known issue caused by the higher precedence of JOIN over the comma (,). We can fix the problem simply by using JOINs instead of commas.
- Loading branch information
1 parent
b922ae5
commit dbd5627
Showing
6 changed files
with
168 additions
and
18 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,75 @@ | ||
| # | ||
| # MDEV-24343 Spider Left join failed Unknown column 't0.ID' in 'on clause' | ||
| # | ||
| for master_1 | ||
| for child2 | ||
| child2_1 | ||
| child2_2 | ||
| child2_3 | ||
| for child3 | ||
| connection child2_1; | ||
| CREATE DATABASE auto_test_remote; | ||
| USE auto_test_remote; | ||
| CREATE TABLE tbl_a ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `first_name` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
| INSERT INTO `tbl_a` VALUES (1,'RICHARD'), (2,'STEPHANE'), (3,'ALAIN'); | ||
| CREATE TABLE `tbl_b` ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `last_name` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`ID`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
| INSERT INTO `tbl_b` VALUES (1,'DEMONGEOT'),(2,'VAROQUI'); | ||
| CREATE TABLE `tbl_c` ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `surname` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
| INSERT INTO `tbl_c` VALUES (1,'CON'),(2,'MOYEN'),(3,'MOYEN2'); | ||
| SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id; | ||
| id last_name id surname id first_name | ||
| 1 DEMONGEOT 1 CON 1 RICHARD | ||
| 2 VAROQUI 2 MOYEN 2 STEPHANE | ||
| connection master_1; | ||
| CREATE DATABASE auto_test_local; | ||
| USE auto_test_local; | ||
| CREATE TABLE tbl_a ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `first_name` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' | ||
| PARTITION BY LIST COLUMNS(`id`) ( | ||
| PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' | ||
| ); | ||
| CREATE TABLE `tbl_b` ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `last_name` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b"' | ||
| PARTITION BY LIST COLUMNS(`id`) ( | ||
| PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' | ||
| ); | ||
| CREATE TABLE `tbl_c` ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `surname` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_c"' | ||
| PARTITION BY LIST COLUMNS(`id`) ( | ||
| PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' | ||
| ); | ||
| SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id; | ||
| id last_name id surname id first_name | ||
| 1 DEMONGEOT 1 CON 1 RICHARD | ||
| 2 VAROQUI 2 MOYEN 2 STEPHANE | ||
| connection master_1; | ||
| DROP DATABASE auto_test_local; | ||
| connection child2_1; | ||
| DROP DATABASE auto_test_remote; | ||
| for master_1 | ||
| for child2 | ||
| child2_1 | ||
| child2_2 | ||
| child2_3 | ||
| for child3 |
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,84 @@ | ||
| --echo # | ||
| --echo # MDEV-24343 Spider Left join failed Unknown column 't0.ID' in 'on clause' | ||
| --echo # | ||
|
|
||
| --disable_query_log | ||
| --disable_result_log | ||
| --source ../t/test_init.inc | ||
| --enable_result_log | ||
| --enable_query_log | ||
|
|
||
| --connection child2_1 | ||
| CREATE DATABASE auto_test_remote; | ||
| USE auto_test_remote; | ||
|
|
||
| eval CREATE TABLE tbl_a ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `first_name` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; | ||
|
|
||
| INSERT INTO `tbl_a` VALUES (1,'RICHARD'), (2,'STEPHANE'), (3,'ALAIN'); | ||
|
|
||
| eval CREATE TABLE `tbl_b` ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `last_name` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`ID`) | ||
| ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; | ||
|
|
||
| INSERT INTO `tbl_b` VALUES (1,'DEMONGEOT'),(2,'VAROQUI'); | ||
|
|
||
| eval CREATE TABLE `tbl_c` ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `surname` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; | ||
|
|
||
| INSERT INTO `tbl_c` VALUES (1,'CON'),(2,'MOYEN'),(3,'MOYEN2'); | ||
|
|
||
| SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id; | ||
|
|
||
| --connection master_1 | ||
| CREATE DATABASE auto_test_local; | ||
| USE auto_test_local; | ||
|
|
||
| eval CREATE TABLE tbl_a ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `first_name` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"' | ||
| PARTITION BY LIST COLUMNS(`id`) ( | ||
| PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' | ||
| ); | ||
|
|
||
| eval CREATE TABLE `tbl_b` ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `last_name` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_b"' | ||
| PARTITION BY LIST COLUMNS(`id`) ( | ||
| PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' | ||
| ); | ||
|
|
||
| eval CREATE TABLE `tbl_c` ( | ||
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | ||
| `surname` varchar(255) DEFAULT NULL, | ||
| PRIMARY KEY (`id`) | ||
| ) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_c"' | ||
| PARTITION BY LIST COLUMNS(`id`) ( | ||
| PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' | ||
| ); | ||
|
|
||
| SELECT * from tbl_b JOIN tbl_c ON tbl_b.id = tbl_c.id LEFT OUTER JOIN tbl_a ON tbl_a.id = tbl_b.id; | ||
|
|
||
| --connection master_1 | ||
| DROP DATABASE auto_test_local; | ||
|
|
||
| --connection child2_1 | ||
| DROP DATABASE auto_test_remote; | ||
|
|
||
| --disable_query_log | ||
| --disable_result_log | ||
| --source ../t/test_deinit.inc | ||
| --enable_result_log | ||
| --enable_query_log |
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
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