mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 10:47:22 +00:00
Snowflake: support trailing options in CREATE TABLE
(#1931)
This commit is contained in:
parent
bc2c4e263d
commit
750a7aa054
6 changed files with 80 additions and 20 deletions
|
@ -4347,8 +4347,9 @@ fn parse_create_table_as() {
|
|||
// BigQuery allows specifying table schema in CTAS
|
||||
// ANSI SQL and PostgreSQL let you only specify the list of columns
|
||||
// (without data types) in a CTAS, but we have yet to support that.
|
||||
let dialects = all_dialects_where(|d| d.supports_create_table_multi_schema_info_sources());
|
||||
let sql = "CREATE TABLE t (a INT, b INT) AS SELECT 1 AS b, 2 AS a";
|
||||
match verified_stmt(sql) {
|
||||
match dialects.verified_stmt(sql) {
|
||||
Statement::CreateTable(CreateTable { columns, query, .. }) => {
|
||||
assert_eq!(columns.len(), 2);
|
||||
assert_eq!(columns[0].to_string(), "a INT".to_string());
|
||||
|
@ -4453,20 +4454,6 @@ fn parse_create_or_replace_table() {
|
|||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
let sql = "CREATE TABLE t (a INT, b INT) AS SELECT 1 AS b, 2 AS a";
|
||||
match verified_stmt(sql) {
|
||||
Statement::CreateTable(CreateTable { columns, query, .. }) => {
|
||||
assert_eq!(columns.len(), 2);
|
||||
assert_eq!(columns[0].to_string(), "a INT".to_string());
|
||||
assert_eq!(columns[1].to_string(), "b INT".to_string());
|
||||
assert_eq!(
|
||||
query,
|
||||
Some(Box::new(verified_query("SELECT 1 AS b, 2 AS a")))
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue