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 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
Is your feature request related to a problem or challenge?
DataFusion's current operator precedence is (high to low):
Modern Postgres implements:
We claim to match Postgres 7.2, which does:
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