Add support for Snowflake identifier function#1929
Conversation
| } else if let Some(func_part) = | ||
| self.maybe_parse(|parser| parser.parse_object_name_function_part())? |
There was a problem hiding this comment.
wondering can we instead extende the else clause to do something like this?
else {
let ident = self.parse_identifier()?;
let part = if self.dialect.is_identifier_generating_function_name(&ident) {
self.expect_token(&Token::LParen)?;
let args = ...
self.expect_token(&Token::RParen)?;
ObjectNamePartFunction { name:ident, args }
} else {
ObjectNamePart::Identifier(ident));
}
}thinking that way we skip this extra branch, and the extra error scenario in the function part parsing
| snowflake().verified_stmt(create_view_with_tag); | ||
| } | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
Could we add a test scenario for how this interacts with the double dot feature?
There was a problem hiding this comment.
In what way? I believe you cannot chain IDENTIFIER. For example, this is illegal: SELECT * FROM IDENTIFIER('db1')..IDENTIFIER('tbl1').
There was a problem hiding this comment.
Yeah was thinking a test as in your example to demonstrate if/how the parser handles it. If its unsupported then it'll be a negative test
iffyio
left a comment
There was a problem hiding this comment.
LGTM! Thanks @yoavcloud!
cc @alamb
Expand the support for the
IDENTIFIERfunction in Snowflake, which is used to generate identifiers dynamically. See here: https://docs.snowflake.com/en/sql-reference/identifier-literalThe ObjectNamePart enum was extended with a new part type to support the use of the identifier function as an object name. Some work went into organizing
Parser:parse_object_namea bit.A few examples: