dolthub / dolthub/dolt

Allow implicit lateral join for table functions

Open
#9,996 0 comments 0 reactions 1 assignee Claimed by @nicktobey View on GitHub
enhancement sql version control
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

According to the MySQL spec:

> MySQL always treats a join with a table function such as [JSON_TABLE()](https://dev.mysql.com/doc/refman/8.4/en/json-table-functions.html#function_json-table) as though LATERAL had been used. Since the LATERAL keyword is implicit, it is not allowed before JSON_TABLE(); this is also according to the SQL standard.

This suggests that the following two statements are equivalent, but only the first is accepted.

```sql
select l.commit_order as child, r.commit_order as parent from dolt_log() l join lateral (select * from dolt_log(l.commit_hash)) r; -- allowed
select l.commit_order as child, r.commit_order as parent from dolt_log() l join dolt_log(l.commit_hash) r; -- rejected
```

The latter statement results in the error `table not found: l`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.