snowflake/generic: position can be the name of a column (#1022)

Co-authored-by: Lukasz Stefaniak <lustefaniak@gmail.com>
This commit is contained in:
Andrew Lamb 2023-10-23 18:07:00 -04:00 committed by GitHub
parent ce62fe6d27
commit 2798b65b42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -794,7 +794,9 @@ impl<'a> Parser<'a> {
Keyword::EXTRACT => self.parse_extract_expr(),
Keyword::CEIL => self.parse_ceil_floor_expr(true),
Keyword::FLOOR => self.parse_ceil_floor_expr(false),
Keyword::POSITION => self.parse_position_expr(),
Keyword::POSITION if self.peek_token().token == Token::LParen => {
self.parse_position_expr()
}
Keyword::SUBSTRING => self.parse_substring_expr(),
Keyword::OVERLAY => self.parse_overlay_expr(),
Keyword::TRIM => self.parse_trim_expr(),

View file

@ -1067,6 +1067,12 @@ fn test_snowflake_trim() {
);
}
#[test]
fn parse_position_not_function_columns() {
snowflake_and_generic()
.verified_stmt("SELECT position FROM tbl1 WHERE position NOT IN ('first', 'last')");
}
#[test]
fn parse_subquery_function_argument() {
// Snowflake allows passing an unparenthesized subquery as the single