Allow empty options for BigQuery (#1657)

Co-authored-by: Martin Abelson Sahlen <sahlen@Mac.lan>
This commit is contained in:
Martin Abelson Sahlen 2025-01-16 10:27:26 +02:00 committed by GitHub
parent 36db176657
commit 9105cae261
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -7341,7 +7341,7 @@ impl<'a> Parser<'a> {
pub fn parse_options(&mut self, keyword: Keyword) -> Result<Vec<SqlOption>, ParserError> {
if self.parse_keyword(keyword) {
self.expect_token(&Token::LParen)?;
let options = self.parse_comma_separated(Parser::parse_sql_option)?;
let options = self.parse_comma_separated0(Parser::parse_sql_option, Token::RParen)?;
self.expect_token(&Token::RParen)?;
Ok(options)
} else {

View file

@ -473,6 +473,12 @@ fn parse_create_table_with_options() {
r#"description = "table option description")"#
);
bigquery().verified_stmt(sql);
let sql = "CREATE TABLE foo (x INT64) OPTIONS()";
bigquery().verified_stmt(sql);
let sql = "CREATE TABLE db.schema.test (x INT64 OPTIONS(description = 'An optional INTEGER field')) OPTIONS()";
bigquery().verified_stmt(sql);
}
#[test]