mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
Snowflake - support table function in table factor (regression) (#1996)
This commit is contained in:
parent
183bc7c5ff
commit
18b4a14e0f
2 changed files with 7 additions and 1 deletions
|
@ -515,6 +515,8 @@ impl Dialect for SnowflakeDialect {
|
|||
fn is_table_factor(&self, kw: &Keyword, parser: &mut Parser) -> bool {
|
||||
match kw {
|
||||
Keyword::LIMIT if peek_for_limit_options(parser) => false,
|
||||
// Table function
|
||||
Keyword::TABLE if matches!(parser.peek_token_ref().token, Token::LParen) => true,
|
||||
_ => !RESERVED_KEYWORDS_FOR_TABLE_FACTOR.contains(kw),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3609,9 +3609,13 @@ fn test_sql_keywords_as_table_aliases() {
|
|||
#[test]
|
||||
fn test_sql_keywords_as_table_factor() {
|
||||
// LIMIT is a table factor, Snowflake does not reserve it
|
||||
snowflake().one_statement_parses_to("SELECT * FROM tbl, LIMIT", "SELECT * FROM tbl, LIMIT");
|
||||
snowflake().verified_stmt("SELECT * FROM tbl, LIMIT");
|
||||
// LIMIT is not a table factor
|
||||
snowflake().one_statement_parses_to("SELECT * FROM tbl, LIMIT 1", "SELECT * FROM tbl LIMIT 1");
|
||||
|
||||
// Table functions are table factors
|
||||
snowflake().verified_stmt("SELECT 1 FROM TABLE(GENERATOR(ROWCOUNT => 10)) AS a, TABLE(GENERATOR(ROWCOUNT => 10)) AS b");
|
||||
|
||||
// ORDER is reserved
|
||||
assert!(snowflake()
|
||||
.parse_sql_statements("SELECT * FROM tbl, order")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue