A column or variable is assigned its own value

tx0/sql:self-assignmentrecommendedwarningreliability/logicdepth fastbug

What it finds

x := x, SET @n = @n, UPDATE t SET a = a: a column or variable is assigned its own value, which changes nothing. Usually the right side was meant to be another name.

MySQL's ON DUPLICATE KEY UPDATE id = id, the way to ignore a duplicate, is left alone.

From the rule's source, self_assignment.rs.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/sql:self-assignment" = "warning"

To keep one finding, suppress it with a reason: tx0 suppress ID --reason "..." writes the comment for it.

tx0 explain tx0/sql:self-assignment shows the same in the terminal. Found a false positive? Report it.