[MDEV-12381] Add support for LIMIT in subqueries in the IN (...) clause Created: 2017-03-28  Updated: 2018-11-26

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

Type: Task Priority: Major
Reporter: Valerii Kravchuk Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-139 LIMIT and subqueries Open

 Description   

Other databases (like PostgreSQL) allow to use subqueries that get limited number of rows in the IN(...) clause, similar to this:

SELECT ... FROM ... WHERE outer_expr IN (SELECT inner_expr FROM ... [ORDER BY ...] LIMIT n)

and the semantics is to first apply the LIMIT clause to the subquery output and then make the "outer_col IN (...)" check.

It would be nice to add support for this specific case of LIMIT in subqueries (with ORDER BY or without), as now we get a generic error message:

ERROR 1235 (42000): This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

This specific case of IN subquery support should be implemented separately as it conflicts with current IN->EXISTS rewrite that is unique to IN subqueries.



 Comments   
Comment by Heinz Wiesinger [ 2017-05-24 ]

Seems related to MDEV-139

Generated at Thu Feb 08 07:57:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.