Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4145,6 +4145,8 @@ impl<'a> Parser<'a> {
None
};

let table_options = self.parse_options(Keyword::OPTIONS)?;

// Parse optional `AS ( query )`
let query = if self.parse_keyword(Keyword::AS) {
Some(Box::new(self.parse_query()?))
Expand Down Expand Up @@ -4192,8 +4194,7 @@ impl<'a> Parser<'a> {
};

let strict = self.parse_keyword(Keyword::STRICT);

let table_options = self.parse_options(Keyword::OPTIONS)?;

//Databricks has TBLPROPERTIES after COMMENT
let _table_properties = self.parse_options(Keyword::TBLPROPERTIES)?;
table_properties.extend(_table_properties);
Expand Down
7 changes: 7 additions & 0 deletions tests/sqlparser_bigquery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1385,3 +1385,10 @@ fn test_options_expression() {
"CREATE TABLE `myproject`.`mydataset`.`mytable` (id INT64) OPTIONS (max_staleness = INTERVAL '0-0 0 0:15:0' YEAR TO SECOND)",
);
}

#[test]
fn test_create_table_options_expression() {
bigquery().verified_stmt(
"CREATE OR REPLACE TABLE `myproject`.`mydataset`.`mytable` OPTIONS (description = \"\"\"Project entity stream base\"\"\") AS (SELECT * FROM `myproject`.`mydataset`.`othertable`)",
);
}