mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-11-03 16:42:54 +00:00
BigQuery: support unquoted hyphen in table/view declaration (#1178)
This commit is contained in:
parent
241da85d67
commit
8dd213cff2
2 changed files with 51 additions and 4 deletions
|
|
@ -3749,7 +3749,8 @@ impl<'a> Parser<'a> {
|
|||
&& self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
|
||||
// Many dialects support `OR ALTER` right after `CREATE`, but we don't (yet).
|
||||
// ANSI SQL and Postgres support RECURSIVE here, but we don't support it either.
|
||||
let name = self.parse_object_name(false)?;
|
||||
let allow_unquoted_hyphen = dialect_of!(self is BigQueryDialect);
|
||||
let name = self.parse_object_name(allow_unquoted_hyphen)?;
|
||||
let columns = self.parse_view_columns()?;
|
||||
let mut options = CreateTableOptions::None;
|
||||
let with_options = self.parse_options(Keyword::WITH)?;
|
||||
|
|
@ -4736,8 +4737,9 @@ impl<'a> Parser<'a> {
|
|||
global: Option<bool>,
|
||||
transient: bool,
|
||||
) -> Result<Statement, ParserError> {
|
||||
let allow_unquoted_hyphen = dialect_of!(self is BigQueryDialect);
|
||||
let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
|
||||
let table_name = self.parse_object_name(false)?;
|
||||
let table_name = self.parse_object_name(allow_unquoted_hyphen)?;
|
||||
|
||||
// Clickhouse has `ON CLUSTER 'cluster'` syntax for DDLs
|
||||
let on_cluster = if self.parse_keywords(&[Keyword::ON, Keyword::CLUSTER]) {
|
||||
|
|
@ -4752,13 +4754,13 @@ impl<'a> Parser<'a> {
|
|||
};
|
||||
|
||||
let like = if self.parse_keyword(Keyword::LIKE) || self.parse_keyword(Keyword::ILIKE) {
|
||||
self.parse_object_name(false).ok()
|
||||
self.parse_object_name(allow_unquoted_hyphen).ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let clone = if self.parse_keyword(Keyword::CLONE) {
|
||||
self.parse_object_name(false).ok()
|
||||
self.parse_object_name(allow_unquoted_hyphen).ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue