apache / apache/datafusion-sqlparser-rs
Support postgresql on commit for ctas
- Dominant language
- Rust
- Stars
- 3.5k
- Forks
- 772
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 17
Description
Add support for postgresql `[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]`. Currently panics:
```
use sqlparser::dialect::PostgreSqlDialect;
use sqlparser::parser::Parser;
fn main() {
let sql = "create local temporary table test on commit preserve rows as select 1 as a;";
let dialect = PostgreSqlDialect {};
let ast = Parser::parse_sql(&dialect, sql).unwrap();
for stmt in ast.iter() {
println!("{}", stmt.to_string())
}
}
```
`ParserError("Expected end of statement, found: as at Line: 1, Column 59")`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the PostgreSqlDialect and Parser::parse_sql entry points shown in the reproduction, then run the supplied SQL example. Done means the statement parses and formats successfully while supporting PRESERVE ROWS, DELETE ROWS, and DROP after ON COMMIT.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100