Support: Databricks and generic: fix for values as table name (#1278)

This commit is contained in:
Joey Hain 2024-05-20 17:15:40 -07:00 committed by GitHub
parent 54184460b5
commit 9d15f7e9a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 88 additions and 2 deletions

View file

@ -8594,8 +8594,19 @@ impl<'a> Parser<'a> {
self.expected("joined table", self.peek_token())
}
} else if dialect_of!(self is SnowflakeDialect | DatabricksDialect | GenericDialect)
&& self.parse_keyword(Keyword::VALUES)
&& matches!(
self.peek_tokens(),
[
Token::Word(Word {
keyword: Keyword::VALUES,
..
}),
Token::LParen
]
)
{
self.expect_keyword(Keyword::VALUES)?;
// Snowflake and Databricks allow syntax like below:
// SELECT * FROM VALUES (1, 'a'), (2, 'b') AS t (col1, col2)
// where there are no parentheses around the VALUES clause.