You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PostgreSQL: unary minus binds more loosely than ^, so -1 ^ 0 parses as -(1 ^ 0) #2819
tok @ Token::Minus | tok @ Token::Plus => {// ...Ok(Expr::UnaryOp{
op,expr:Box::new(self.parse_subexpr(self.dialect.prec_value(Precedence::MulDivModOp))?,),})}
PostgreSqlDialect sets CARET_PREC (100) above MUL_DIV_MOD_OP_PREC (90) (src/dialect/postgresql.rs#L213-L214). So the operand of the minus also takes the ^ that follows.
For the PostgreSQL dialect, the operand of a unary - or + must be parsed at a precedence above CARET_PREC. In the PostgreSQL table, unary + and - are also above COLLATE and AT.
The generic dialect is not affected in this way: there, Caret is below MulDivModOp.
Activity
Surajsuthar commentedon Nov 4, 2026
@kumarUjjawal are you working on this ?
kumarUjjawal commentedon Nov 4, 2026
Nope