SQLite Forum

operator precedence
Login
Oddly, the docs do not speak of association for most of the binary operators, not even at [Operators](https://sqlite.org/lang_expr.html#operators). I would consider that an improvement opportunity.

The parser favors left association, which reduces stack depth, and SQLite explicitly [a] treats the binary operators of equal precedence as left-associative. Because of the backwards compatibility policy long imposed on the project, users can be quite confident that this associativity is not going to change. If SQLite differed from other DBMS's in this regard, that might be less certain, but it does not.

[a. The Lemon parser's "%left" directive is used in the SQLite3 grammar rules (parse.y) to specify operator associativity; it is not left to the parser generator's default. ]

For the same reasons, and additionally because it has been stated in the docs, the precedence of operators [b] is highly unlikely to change.

[b. Of course, precedence takes higher precedence than associativity. ]

(Edited to clear up an unintended ambiguity. ]