-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
In some logical plans, .derive() creates a new subquery as a derived table like FROM (SELECT ...).
In MySQL, every derived table requires an alias. .derive() does not supply an alias to these derived tables, so the queries fail in MySQL.
To Reproduce
Run a query on MySQL that triggers a logical plan derive, like:
select min(ta.j1_id) as j1_min from j1 ta order by min(ta.j1_id) limit 10;
Observe the query fail, because the re-written SQL contains a derived table without an alias.
Expected behavior
The query should succeed without a syntax error.
Additional context
As seen from the MySQL manual: https://dev.mysql.com/doc/refman/8.4/en/derived-tables.html
The [AS] tbl_name clause is mandatory because every table in a FROM clause must have a name.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working