[MDEV-26665] Regression in IN subquery results in MariaDB 10.5 and 10.6 Created: 2021-09-22 Updated: 2022-07-29 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.5.12, 10.6.4, 10.5, 10.6 |
| Fix Version/s: | 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Jeremy Evans | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
OpenBSD/amd64 and Windows/x86_64 |
||
| Attachments: |
|
| Description |
|
There is a regression in MariaDB 10.5 and 10.6 affecting subqueries accessing tables that use foreign key constraints, possibly limited to queries that use window functions. I've tested that this issue does not affect 10.2, 10.3, and 10.4. If foreign key constraints are enabled, the IN predicate filters rows it shouldn't filter in MariaDB 10.5 and 10.6. If foreign key constraints are not enabled, the IN predicate operates correctly. See attached foreign_key.sql and no_foreign_key.sql files. The only difference between the two is in the use of FOREIGN KEY constraints when creating the tables. On MariaDB 10.2, 10.3, and 10.4, the final query in both files returns: ``` On MariaDB 10.5 and 10.6, the final query in the no_foreign_key.sql file returns both records, but the final query in foreign_key.sql returns only one of the records: ``` There are a total of 5 select queries in both files, with the first four queries showing the same results in both the foreign key and non-foreign key cases. 1) The 1st query shows that there are 2 entries in the artists table. Inlining the common table expression does not change the behavior, so this issue doesn't appear to be related to the use of common table expressions. Both files return expected results (the same results as MariaDB 10.2, 10.3, and 10.4) on SQLite 3.35.5. This issue was discovered during testing of Sequel, a database library for the Ruby programming language. |
| Comments |
| Comment by Alice Sherepa [ 2021-09-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you!
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeremy Evans [ 2022-07-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MariaDB 10.8.3 returns correct results by default and with split_materialized set to both off and on. So I think this issue has been resolved. |