mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
Fix AS query clause should be after the create table options (#1339)
This commit is contained in:
parent
993216f3ac
commit
20f7ac59e3
4 changed files with 61 additions and 10 deletions
|
@ -802,6 +802,30 @@ fn test_query_with_format_clause() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_table_on_commit_and_as_query() {
|
||||
let sql = r#"CREATE LOCAL TEMPORARY TABLE test ON COMMIT PRESERVE ROWS AS SELECT 1"#;
|
||||
match clickhouse_and_generic().verified_stmt(sql) {
|
||||
Statement::CreateTable(CreateTable {
|
||||
name,
|
||||
on_commit,
|
||||
query,
|
||||
..
|
||||
}) => {
|
||||
assert_eq!(name.to_string(), "test");
|
||||
assert_eq!(on_commit, Some(OnCommit::PreserveRows));
|
||||
assert_eq!(
|
||||
query.unwrap().body.as_select().unwrap().projection,
|
||||
vec![UnnamedExpr(Expr::Value(Value::Number(
|
||||
"1".parse().unwrap(),
|
||||
false
|
||||
)))]
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn clickhouse() -> TestedDialects {
|
||||
TestedDialects {
|
||||
dialects: vec![Box::new(ClickHouseDialect {})],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue