apache / apache/datafusion-sqlparser-rs

CTE FROM Statement should be of type ObjectName or TableFactor

Open
#853 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

First of all, thanks for this awesome package!

While parsing the AST, I came Across Cte's FROM Statement:
https://github.com/sqlparser-rs/sqlparser-rs/blob/6b2b3f1f6c903bddc87ba0858b5ccdb94c5e2242/src/ast/query.rs#L337-L341

This renders as WITH ... AS ... FROM ...
While I am not sure which Database actually supports this syntax, I expected FROM to be an `ObjectName` or `TableFactor`, so basically a `Vec` instead of a single `Ident`.

I am not 100% sure this is actually a bug as I don't know which Database supports this syntax. It feels wrong though for this FROM to behave so differently.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/ast/query.rs at the CTE definition around lines 337-341 and inspect how the FROM field is represented in the surrounding AST types. Check which SQL dialects support this form and compare it with ObjectName and TableFactor usage elsewhere. Done means the expected CTE FROM syntax has a consistent, validated AST representation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.