Skip to content

Commit 72beb24

Browse files
authored
fix options (#38)
1 parent ebb64be commit 72beb24

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/parser/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4145,6 +4145,8 @@ impl<'a> Parser<'a> {
41454145
None
41464146
};
41474147

4148+
let table_options = self.parse_options(Keyword::OPTIONS)?;
4149+
41484150
// Parse optional `AS ( query )`
41494151
let query = if self.parse_keyword(Keyword::AS) {
41504152
Some(Box::new(self.parse_query()?))
@@ -4192,8 +4194,7 @@ impl<'a> Parser<'a> {
41924194
};
41934195

41944196
let strict = self.parse_keyword(Keyword::STRICT);
4195-
4196-
let table_options = self.parse_options(Keyword::OPTIONS)?;
4197+
41974198
//Databricks has TBLPROPERTIES after COMMENT
41984199
let _table_properties = self.parse_options(Keyword::TBLPROPERTIES)?;
41994200
table_properties.extend(_table_properties);

tests/sqlparser_bigquery.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1385,3 +1385,10 @@ fn test_options_expression() {
13851385
"CREATE TABLE `myproject`.`mydataset`.`mytable` (id INT64) OPTIONS (max_staleness = INTERVAL '0-0 0 0:15:0' YEAR TO SECOND)",
13861386
);
13871387
}
1388+
1389+
#[test]
1390+
fn test_create_table_options_expression() {
1391+
bigquery().verified_stmt(
1392+
"CREATE OR REPLACE TABLE `myproject`.`mydataset`.`mytable` OPTIONS (description = \"\"\"Project entity stream base\"\"\") AS (SELECT * FROM `myproject`.`mydataset`.`othertable`)",
1393+
);
1394+
}

0 commit comments

Comments
 (0)