Lateral subquery emulation fails on MySQL 5.7

Description

The lateral subquery emulation for MySQL 5.7 currently uses a double nested subquery which is not supported on MySQL. For a lateral subquery that uses a QuerySpec there is another possible emulation which is to simply check in the ON condition if a matching result exists for the correlated subquery i.e. essentially peeling off the double nesting. To support a QuerySpec that uses limit/offset, which is pretty common for lateral subqueries (IMO the main reason to use lateral), we have to add an additional predicate that checks if the amount of rows that come before the currently joined row is between offset and (offset+limit).

Activity

Show:
Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created September 21, 2022 at 9:08 AM
Updated October 5, 2022 at 10:02 AM
Resolved September 21, 2022 at 11:28 AM