Add support of table function WITH ORDINALITY modifier for Postgre Parser (#1337)

This commit is contained in:
hulk 2024-07-10 05:43:22 +08:00 committed by GitHub
parent 285f492589
commit 9108bffc9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 129 additions and 4 deletions

View file

@ -9209,6 +9209,7 @@ impl<'a> Parser<'a> {
let array_exprs = self.parse_comma_separated(Parser::parse_expr)?;
self.expect_token(&Token::RParen)?;
let with_ordinality = self.parse_keywords(&[Keyword::WITH, Keyword::ORDINALITY]);
let alias = match self.parse_optional_table_alias(keywords::RESERVED_FOR_TABLE_ALIAS) {
Ok(Some(alias)) => Some(alias),
Ok(None) => None,
@ -9235,6 +9236,7 @@ impl<'a> Parser<'a> {
array_exprs,
with_offset,
with_offset_alias,
with_ordinality,
})
} else if self.parse_keyword_with_tokens(Keyword::JSON_TABLE, &[Token::LParen]) {
let json_expr = self.parse_expr()?;
@ -9273,6 +9275,8 @@ impl<'a> Parser<'a> {
None
};
let with_ordinality = self.parse_keywords(&[Keyword::WITH, Keyword::ORDINALITY]);
let alias = self.parse_optional_table_alias(keywords::RESERVED_FOR_TABLE_ALIAS)?;
// MSSQL-specific table hints:
@ -9294,6 +9298,7 @@ impl<'a> Parser<'a> {
with_hints,
version,
partitions,
with_ordinality,
};
while let Some(kw) = self.parse_one_of_keywords(&[Keyword::PIVOT, Keyword::UNPIVOT]) {