apache / apache/datafusion-sqlparser-rs

Keywords AT TIME ZONE can be followed by a column

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

Description

We have queries which reference a column after `AT TIME ZONE` rather than just supplying a string. This results in a valid query which executes as expected (in PostgreSQL). The parser currently raises an error `Expected Token::SingleQuotedString after AT TIME ZONE, found: the_column`.

For example, instead of `SELECT datetime_column AT TIME ZONE 'America/Denver' FROM table` it is also valid to have `SELECT datetime_column AT TIME ZONE zone_column FROM table`

I believe further match conditions should be added here to patch: https://github.com/sqlparser-rs/sqlparser-rs/blob/main/src/parser.rs#L1322

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/parser.rs around line 1322, where AT TIME ZONE currently expects a single-quoted string. Check the example queries using a column after the keyword and verify that both literal and column forms parse successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.