(
&mut self,
allow_order_by: bool,
)
| 8655 | } |
| 8656 | |
| 8657 | fn parse_optional_args( |
| 8658 | &mut self, |
| 8659 | allow_order_by: bool, |
| 8660 | ) -> Result<FunctionArgs<Raw>, ParserError> { |
| 8661 | if self.consume_token(&Token::Star) { |
| 8662 | self.expect_token(&Token::RParen)?; |
| 8663 | Ok(FunctionArgs::Star) |
| 8664 | } else if self.consume_token(&Token::RParen) { |
| 8665 | Ok(FunctionArgs::args(vec![])) |
| 8666 | } else { |
| 8667 | let args = self.parse_comma_separated(Parser::parse_expr)?; |
| 8668 | // ORDER BY can only appear after at least one argument, and not after a |
| 8669 | // star. We can ignore checking for it in the other branches. See: |
| 8670 | // https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-AGGREGATES |
| 8671 | let order_by = if allow_order_by && self.parse_keywords(&[ORDER, BY]) { |
| 8672 | self.parse_comma_separated(Parser::parse_order_by_expr)? |
| 8673 | } else { |
| 8674 | vec![] |
| 8675 | }; |
| 8676 | self.expect_token(&Token::RParen)?; |
| 8677 | Ok(FunctionArgs::Args { args, order_by }) |
| 8678 | } |
| 8679 | } |
| 8680 | |
| 8681 | /// Parse `AS OF`, if present. |
| 8682 | fn parse_optional_as_of(&mut self) -> Result<Option<AsOf<Raw>>, ParserError> { |
no test coverage detected