Bug #112108 | VIEW reference in a SELECT subquery returns different results between 5.7 & 8.0 | ||
---|---|---|---|
Submitted: | 18 Aug 2023 7:13 | Modified: | 22 Aug 2023 7:18 |
Reporter: | IVAN HO | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.33, 8.0.34 | OS: | Red Hat (8) |
Assigned to: | CPU Architecture: | Any | |
Tags: | view subquery |
[18 Aug 2023 7:13]
IVAN HO
[18 Aug 2023 7:14]
IVAN HO
test case
Attachment: testcase.sql (application/octet-stream, text), 3.09 KiB.
[18 Aug 2023 7:15]
IVAN HO
Test Case mysql 5.7.39 result
Attachment: testcase 5.7.39 result.sql (application/octet-stream, text), 1.62 KiB.
[18 Aug 2023 7:15]
IVAN HO
Test Case mysql 8.0.33 result
Attachment: testcase 8.0.33 result.sql (application/octet-stream, text), 1.68 KiB.
[21 Aug 2023 8:37]
MySQL Verification Team
Hello IVAN HO, Thank you for the report and test case. regards, Umesh
[22 Aug 2023 7:18]
Roy Lyseng
Posted by developer: We are closing this as not a bug because the view is non-deterministic. The selected expression pos.LEVEL may take different values, based on choices of the optimizer. Hence, due to the optimizer improving between releases, it is impossible to guarantee consistent results. We recommend that the view is rewritten without non-deterministic elements and that ONLY_FULL_GROUP_BY is enabled in SQL mode. It may also be an idea to avoid the use of ORDER BY in the view definition, since it is generally ignored when used in a query.