apache / apache/datafusion-sqlparser-rs

Bug: `SELECT * FROM ( SELECT * FROM APPLICATIONS.SALESFORCE.ACCOUNT) outer` fails to parse in snowflake

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

Description

I hit a bug where the SQL statement
```sql
SELECT * FROM ( SELECT * FROM APPLICATIONS.SALESFORCE.ACCOUNT) outer
```

failed to parse. This is because `OUTER` is part of the reserved keyword list for table aliases. https://github.com/apache/datafusion-sqlparser-rs/blob/8ccb87a8355858ccb06ffc20484657cd7980d78c/src/keywords.rs#L843-L900

Currently this list is a global but it seems like it should be dialect specific. I'm happy to work on this, but I wanted to know if the project had any opinions on how this list should be maintained at the dialect level.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Snowflake query and reading the linked range in src/keywords.rs, especially how OUTER is classified. Then inspect the parser's dialect handling to determine how the reserved-keyword list should be maintained. Done means the reported query parses correctly without regressing keyword handling in other dialects.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.