[MDEV-31229] Extend check_equality_for_exist2in() to cover inner table expressions Created: 2023-05-10  Updated: 2023-05-10

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Fix Version/s: None

Type: Task Priority: Major
Reporter: Yuchen Pei Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: optimizer-easy

Issue Links:
Relates
relates to MDEV-22534 Trivial correlation detection/removal... In Review

 Description   

The function check_equality_for_exist2in() used for picking out equalities for the exists-to-in transformation only "Check if 'func' is an equality in form "inner_table.column = outer_expr"". Extend this so that it checks "inner_expr = outer_expr".

Note that there may be issues when inner_expr is a row, as for example

exists (select * from it where ((it.a, it.b), it.c) = ((ot.a, ot.b), ot.c))
=>
((ot.a, ot.b), ot.c) in (select ((it.a, it.b), it.c) from it)

is illegal because we can't select like this.

Thus for starters, perhaps limit it to scalar expressions only.



 Comments   
Comment by Oleksandr Byelkin [ 2023-05-10 ]

I'd make separation between expression support and row type support.

Generated at Thu Feb 08 10:22:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.