neilconway opened a new issue, #22461:
URL: https://github.com/apache/datafusion/issues/22461

   ### Is your feature request related to a problem or challenge?
   
   DataFusion's current operator precedence is (high to low):
   
   ```
   - 45: * / %
   - 40: + -
   - 30: IS DISTINCT FROM, IS NOT DISTINCT FROM, regex (~, !~, ~*, !~*), 
bitwise, ||, …
   - 25: LIKE / NOT LIKE / ILIKE / NOT ILIKE
   - 20: < >
   - 15: = != <= >=
   - 10: AND
   - 5: OR
   ```
   
   [Modern Postgres 
](https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-PRECEDENCE)implements:
   
   ```
   - * / %
   - + -
   - (any other operator: ||, regex, bitwise)
   - BETWEEN IN LIKE ILIKE SIMILAR (non-assoc)
   - < > = <= >= <> (non-assoc, all six together)
   - IS ISNULL NOTNULL (incl. IS DISTINCT FROM)
   - NOT, AND, OR
   ```
   
   We claim to match Postgres 7.2, which does:
   
   ```
   - IS, ISNULL, NOTNULL (rank 6 — high)
   - (any other operator — ||, regex, bitwise, and <=, >=, <> since they aren't 
listed) (rank 7)
   - LIKE ILIKE (rank 11)
   - < > (rank 12)
   - = (rank 13)
   ```
   
   So we're consistent with neither version of Postgres. I'd argue we should 
move to be consistent with modern Postgres.
   
   ### Describe the solution you'd like
   
   _No response_
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to