Both operands of a comparison, logical or arithmetic operator are the same expression
What it finds
a.x = a.x, x - x, p AND p: the same expression on both sides of an operator whose result is then fixed, or which repeats a condition. It is usually a copy that was meant to name another column, table alias or variable.
Constants are left to other rules, and so are expressions that call functions whose result changes from call to call, such as random() or NEWID().
From the rule's source, identical_operands.rs.
Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/sql:identical-operands" = "off"To keep one finding, suppress it with a reason: tx0 suppress ID --reason "..." writes the comment for it.
tx0 explain tx0/sql:identical-operands shows the same in the terminal. Found a false positive? Report it.