| Bug #112768 | Inconsistent results when tables are JOINed in a different order | ||
|---|---|---|---|
| Submitted: | 19 Oct 2023 7:15 | Modified: | 19 Oct 2023 10:12 |
| Reporter: | Wang Ke | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
| Version: | 8.1.0, 8.0.34 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[19 Oct 2023 7:15]
Wang Ke
[19 Oct 2023 7:57]
MySQL Verification Team
Hello Ke Wang, Thank you for the report and test case. regards, Umesh
[19 Oct 2023 10:12]
Roy Lyseng
Posted by developer:
This is not a bug. EXPLAIN ANALYZE for the query that succeeds tells us:
-> Inner hash join (no condition) (cost=0.7 rows=1) (actual time=0.119..0.119 rows=0 loops=1)
-> Filter: (json_extract(t1.c2,'$.key') = 'abc') (cost=0.35 rows=1) (never executed)
-> Table scan on t1 (cost=0.35 rows=1) (never executed)
-> Hash
-> Table scan on t0 (cost=0.35 rows=1) (actual time=0.0799..0.0799 rows=0 loops=1)
Thus, the predicate that may cause an error is never evaluated and thus the query completes normally.
The inverse join order will evaluate the predicate and cause an error.
