[MDEV-28196] Correlated derived tables not supported Created: 2022-03-30  Updated: 2023-11-30

Status: Open
Project: MariaDB Server
Component/s: Data Manipulation - Subquery, Optimizer
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Lukas Eder Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: compat80, optimizer-feature

Issue Links:
Relates
relates to MDEV-26831 New name resolution Open

 Description   

The following query is currently not possible in MariaDB:

CREATE TABLE t (x int);
 
SELECT (
  SELECT u.x
  FROM (
    SELECT t.x
  ) u
)
FROM t;

The error I'm getting is:

SQL Error [1109] [42S02]: (conn:9) Unknown table 't' in field list

Most RDBMS, including recent versions of MySQL 8 now support correlating derived tables like that. It's an essential feature for more sophisticated queries.



 Comments   
Comment by Simon Martinelli [ 2022-03-30 ]

This is a very important feature especially with XML and JSON functions!

Comment by Sergei Petrunia [ 2022-05-05 ]

Thanks for the input...

Thinking of what is needed to implement this:

  • The executor should empty the temporary tables
  • Fix name resolution code to allow the outside references...
Generated at Thu Feb 08 09:58:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.