Skip to content

Commit 53944f4

Browse files
committed
Fixes based on comments
1 parent 02070c4 commit 53944f4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/ast/ddl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,7 @@ pub struct CreateTable {
29032903
pub volatile: bool,
29042904
/// `ICEBERG` clause
29052905
pub iceberg: bool,
2906-
/// BigQuery `SNAPSHOT` clause
2906+
/// `SNAPSHOT` clause
29072907
/// <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_snapshot_table_statement>
29082908
pub snapshot: bool,
29092909
/// Table name

src/ast/helpers/stmt_create_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub struct CreateTableBuilder {
8181
pub volatile: bool,
8282
/// Iceberg-specific table flag.
8383
pub iceberg: bool,
84-
/// BigQuery `SNAPSHOT` table flag.
84+
/// `SNAPSHOT` table flag.
8585
pub snapshot: bool,
8686
/// Whether `DYNAMIC` table option is set.
8787
pub dynamic: bool,

src/parser/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5099,7 +5099,7 @@ impl<'a> Parser<'a> {
50995099
let persistent = dialect_of!(self is DuckDbDialect)
51005100
&& self.parse_one_of_keywords(&[Keyword::PERSISTENT]).is_some();
51015101
let create_view_params = self.parse_create_view_params()?;
5102-
if self.parse_keywords(&[Keyword::SNAPSHOT, Keyword::TABLE]) {
5102+
if self.peek_keywords(&[Keyword::SNAPSHOT, Keyword::TABLE]) {
51035103
self.parse_create_snapshot_table().map(Into::into)
51045104
} else if self.parse_keyword(Keyword::TABLE) {
51055105
self.parse_create_table(or_replace, temporary, global, transient)
@@ -6316,10 +6316,11 @@ impl<'a> Parser<'a> {
63166316
.build())
63176317
}
63186318

6319-
/// Parse BigQuery `CREATE SNAPSHOT TABLE` statement.
6319+
/// Parse `CREATE SNAPSHOT TABLE` statement.
63206320
///
63216321
/// <https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_snapshot_table_statement>
63226322
pub fn parse_create_snapshot_table(&mut self) -> Result<CreateTable, ParserError> {
6323+
self.expect_keywords(&[Keyword::SNAPSHOT, Keyword::TABLE])?;
63236324
let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
63246325
let table_name = self.parse_object_name(true)?;
63256326

tests/sqlparser_bigquery.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2893,7 +2893,7 @@ fn test_alter_schema() {
28932893

28942894
#[test]
28952895
fn test_create_snapshot_table() {
2896-
bigquery().verified_stmt("CREATE SNAPSHOT TABLE dataset_id.table1 CLONE dataset_id.table2");
2896+
bigquery_and_generic().verified_stmt("CREATE SNAPSHOT TABLE dataset_id.table1 CLONE dataset_id.table2");
28972897

28982898
bigquery().verified_stmt(
28992899
"CREATE SNAPSHOT TABLE IF NOT EXISTS dataset_id.table1 CLONE dataset_id.table2",

0 commit comments

Comments
 (0)