mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-12-23 11:12:51 +00:00
add support for custom operators in postgres (#1302)
Co-authored-by: Joey Hain <joey@sigmacomputing.com>
This commit is contained in:
parent
2fb919d8b2
commit
4b60866bc7
7 changed files with 203 additions and 46 deletions
|
|
@ -2344,9 +2344,8 @@ impl<'a> Parser<'a> {
|
|||
return infix;
|
||||
}
|
||||
|
||||
let tok = self.next_token();
|
||||
|
||||
let regular_binary_operator = match &tok.token {
|
||||
let mut tok = self.next_token();
|
||||
let regular_binary_operator = match &mut tok.token {
|
||||
Token::Spaceship => Some(BinaryOperator::Spaceship),
|
||||
Token::DoubleEq => Some(BinaryOperator::Eq),
|
||||
Token::Eq => Some(BinaryOperator::Eq),
|
||||
|
|
@ -2410,6 +2409,7 @@ impl<'a> Parser<'a> {
|
|||
Token::Question => Some(BinaryOperator::Question),
|
||||
Token::QuestionAnd => Some(BinaryOperator::QuestionAnd),
|
||||
Token::QuestionPipe => Some(BinaryOperator::QuestionPipe),
|
||||
Token::CustomBinaryOperator(s) => Some(BinaryOperator::Custom(core::mem::take(s))),
|
||||
|
||||
Token::Word(w) => match w.keyword {
|
||||
Keyword::AND => Some(BinaryOperator::And),
|
||||
|
|
@ -2964,7 +2964,8 @@ impl<'a> Parser<'a> {
|
|||
| Token::AtAt
|
||||
| Token::Question
|
||||
| Token::QuestionAnd
|
||||
| Token::QuestionPipe => Ok(Self::PG_OTHER_PREC),
|
||||
| Token::QuestionPipe
|
||||
| Token::CustomBinaryOperator(_) => Ok(Self::PG_OTHER_PREC),
|
||||
_ => Ok(0),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue