[MDEV-6373] Add support for LATERAL keyword Created: 2014-06-22  Updated: 2023-11-30

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

Type: New Feature Priority: Major
Reporter: Emil Assignee: Unassigned
Resolution: Unresolved Votes: 21
Labels: None

Issue Links:
PartOf
is part of MDEV-19078 Support lateral derived tables Open

 Description   

The SQL standard defines the LATERAL keyword, which can be found on
https://mariadb.com/kb/en/select-statement/

LATERAL combined with joins are very useful, because you can reference columns in the left hand side from the right hand side. A good use case is the following. Let's say you have Posts and Comments and you want the first three comments for each post.

SELECT * FROM Posts CROSS JOIN LATERAL (SELECT * FROM Comments WHERE Comments.PostID = Posts.ID LIMIT 3)

That works in PostgreSQL. SQL Server instead has APPLY which is similar.

If this will be supported, Entity Framework will work much better with MariaDB. EF expects that the database has support for these kind of queries, so some queries make the EF provider throw an exception when used with MySQL/MariaDB.
For example:
http://stackoverflow.com/questions/11389050/linq-filterling-result
http://stackoverflow.com/questions/14157877/exception-after-installation-of-net-framework-4-5-using-entity-framework-and-my
http://forums.devart.com/viewtopic.php?t=18989

Both Oracle and PostgreSQL has recently implemented support. MariaDB should too



 Comments   
Comment by Nuno [ 2019-03-19 ]

MySQL 8.0 implemented this.

Really useful, as many times I need this feature and I don't have it.

SQL Server has OUTER APPLY and CROSS APPLY.

Any plans for MariaDB to implement LATERAL?

Comment by Assen Totin (Inactive) [ 2019-05-14 ]

We definitely see interest for this feature, especially when we compare to ourselves to Postgre. Actual use cases for potential customers exist.

Comment by Steve Keil (Inactive) [ 2019-05-15 ]

I also recently was on some sales calls where customers have asked if we support LATERAL, and it was mentioned that MySQL8 does! Would be great to get this in the queue.

Comment by Cyrille37 [ 2019-08-10 ]

Hello,
Please, redo your "vote" and "watch" on issue MDEV-19078 that is more recent, and has an "assigned" status
Cheers

Comment by Nuno [ 2022-02-07 ]

MDEV-19078 has 33 votes while MDEV-6373 has only 19 votes.

MDEV-19078 (with more votes) was removed the "Fix version" so it will no longer appear in the results sorted by Votes, for a specific milestone/fix version.

And meanwhile, MDEV-6373 was bumped to fix version 10.9.

Seriously... MariaDB is the only DB I know that still doesn't support LATERAL / OUTER APPLY.

Comment by Nuno [ 2022-03-28 ]

igor serg marko Any updates on the plan for MDEV-19078 and MDEV-6373, please?
Thank you very much!

Comment by Sergei Golubchik [ 2022-03-30 ]

sorry, there's no immediate plan at the moment

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