-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query gets a unstable result using subquery #51107
Labels
affects-6.5
affects-7.1
affects-7.5
affects-8.0
fuzz/randomtest
severity/critical
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Comments
mysql> SELECT 1 FROM `tlc07c2a51` WHERE NOT (`tlc07c2a51`.`col_1`>=(SELECT GROUP_CONCAT(`tc4cf4a6b`.`col_7` ORDER BY `tc4cf4a6b`.`col_7` SEPARATOR ',') AS `r0` FROM (`tlc07c2a51`) JOIN `tc4cf4a6b` WHERE ISNULL(`tc4cf4a6b`.`col_3`) AND `tlc07c2a51`.`col_4`>='["NYgnnX5uxZj2qhi7RxTg7w8GriqOgEhwDDDuxwZkUL3EuGFmFOEcNkPoITHPZOeD","ii5guPlppEAgINRRDndFtFfjWGjLQRqrf1AAktXy4SPcarECLOOxbktbvzCxyeaR"]' HAVING `tlc07c2a51`.`col_6`>1951988 OR `tlc07c2a51`.`col_6` IN (1838012,786934,638143,0) LIMIT 1688636325)) OR NOT (`tlc07c2a51`.`col_2`>='["UbQgheO4prkdWF1eKMkbtHZjnlMfojS1XdbwmfWVqt7bptGWwpQ4plpAr13zsyWq","HSFqQak4USQouqM125zw0zuB4XJlqW20QDCOq8yLjqp3wXLxu1xDtL1KStmSuFIE","moDOvJkqkd6Hfaw1Zg3MrXIWeFfAYW0uEwVZVYMgRJ3ubuhVOwJlC2vnJAVp003m","CbI0SmqvzogJAKHzrlMGeGEbCdqdDkruwiIBSRrc5GhlGUzWr7l1y0k14yQvQEvC","ESwGiOfLp58cHvv8lNDQ5hTkPyTpenW9a0MPAeBCUtuUd1AN3W5pDdIpLJ8C0UMG"]') GROUP BY `tlc07c2a51`.`col_1`,`tlc07c2a51`.`col_2`,`tlc07c2a51`.`col_7` HAVING `tlc07c2a51`.`col_2`<'["A4DPVw6JJhydzFhBemuCdAdD2weNjO3wgHGU5Enj851XO44fveqlgpXUIK9yyPbG","aN5n4M8vhQlNbRcPut5sEPLi8PjehEk2LkxzktkXacRFBBL72N6VCoBJJXHR01Zb","WxgjpSizALeQZFogukKB5vI9TvE81FXxXTtKOMgPT5H9hoY3twtQWyb8nVKQbJ8a","6g78O3U0DBbgNzpQlOnf2AYySUb48QAjTJqQApPbPPllXCBX3RPBtFp9bL1bykDc","9VjoUp4CbCMRS8BAkoMRmdvXMyjVdjXflRvxevKQclE16GF67FxFsGekrzhI1Gov"]' OR `tlc07c2a51`.`col_2`>='["9ltjaNIwRpckXJVEKO37CcDebMytdsLYfz6a00MIvMSGqCSk4CL7hveU7fOTxb1D","EBQpLQUDhCdazdmBvo55FrMCel0YR6RVr1ahBprj3cRQDgXPgx5rK5DRPQo10Sl3","bvVjOQsUHIOBV3SxizfOGB41QKcDMcMnyt2Z4AumL9CIBTj6c1oEOkCukBnq2qCn"]';
Empty set (0.00 sec)
mysql> SELECT 1 FROM `tlc07c2a51` WHERE NOT (`tlc07c2a51`.`col_1`>=(SELECT GROUP_CONCAT(`tc4cf4a6b`.`col_7` ORDER BY `tc4cf4a6b`.`col_7` SEPARATOR ',') AS `r0` FROM (`tlc07c2a51`) JOIN `tc4cf4a6b` WHERE ISNULL(`tc4cf4a6b`.`col_3`) AND `tlc07c2a51`.`col_4`>='["NYgnnX5uxZj2qhi7RxTg7w8GriqOgEhwDDDuxwZkUL3EuGFmFOEcNkPoITHPZOeD","ii5guPlppEAgINRRDndFtFfjWGjLQRqrf1AAktXy4SPcarECLOOxbktbvzCxyeaR"]' HAVING `tlc07c2a51`.`col_6`>1951988 OR `tlc07c2a51`.`col_6` IN (1838012,786934,638143,0) LIMIT 1688636325)) OR NOT (`tlc07c2a51`.`col_2`>='["UbQgheO4prkdWF1eKMkbtHZjnlMfojS1XdbwmfWVqt7bptGWwpQ4plpAr13zsyWq","HSFqQak4USQouqM125zw0zuB4XJlqW20QDCOq8yLjqp3wXLxu1xDtL1KStmSuFIE","moDOvJkqkd6Hfaw1Zg3MrXIWeFfAYW0uEwVZVYMgRJ3ubuhVOwJlC2vnJAVp003m","CbI0SmqvzogJAKHzrlMGeGEbCdqdDkruwiIBSRrc5GhlGUzWr7l1y0k14yQvQEvC","ESwGiOfLp58cHvv8lNDQ5hTkPyTpenW9a0MPAeBCUtuUd1AN3W5pDdIpLJ8C0UMG"]') GROUP BY `tlc07c2a51`.`col_1`,`tlc07c2a51`.`col_2`,`tlc07c2a51`.`col_7` HAVING `tlc07c2a51`.`col_2`<'["A4DPVw6JJhydzFhBemuCdAdD2weNjO3wgHGU5Enj851XO44fveqlgpXUIK9yyPbG","aN5n4M8vhQlNbRcPut5sEPLi8PjehEk2LkxzktkXacRFBBL72N6VCoBJJXHR01Zb","WxgjpSizALeQZFogukKB5vI9TvE81FXxXTtKOMgPT5H9hoY3twtQWyb8nVKQbJ8a","6g78O3U0DBbgNzpQlOnf2AYySUb48QAjTJqQApPbPPllXCBX3RPBtFp9bL1bykDc","9VjoUp4CbCMRS8BAkoMRmdvXMyjVdjXflRvxevKQclE16GF67FxFsGekrzhI1Gov"]' OR `tlc07c2a51`.`col_2`>='["9ltjaNIwRpckXJVEKO37CcDebMytdsLYfz6a00MIvMSGqCSk4CL7hveU7fOTxb1D","EBQpLQUDhCdazdmBvo55FrMCel0YR6RVr1ahBprj3cRQDgXPgx5rK5DRPQo10Sl3","bvVjOQsUHIOBV3SxizfOGB41QKcDMcMnyt2Z4AumL9CIBTj6c1oEOkCukBnq2qCn"]';
+---+
| 1 |
+---+
| 1 |
| 1 |
+---+
2 rows in set, 1 warning (0.01 sec) |
If you want to reproduce this bug, you should analyze two table before running the query. |
ti-chi-bot
bot
added
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
may-affects-6.5
may-affects-7.1
may-affects-7.5
labels
Feb 19, 2024
I simply the SQL like this.
|
13 tasks
|
hawkingrei
added
may-affects-6.5
and removed
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
may-affects-6.5
labels
Mar 20, 2024
This was referenced Mar 21, 2024
Merged
Merged
Merged
Merged
13 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-6.5
affects-7.1
affects-7.5
affects-8.0
fuzz/randomtest
severity/critical
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
The query gets a stable result.
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
4e41699
The text was updated successfully, but these errors were encountered: