@@IDENTITY is read, which may return an identity made by a trigger

tx0/sql:identity-globalrecommendedwarningreliability/equalitydepth fastbug

What it finds

@@IDENTITY returns the last identity value made in the session, in any scope: if an insert fires a trigger that inserts into another table, it returns that table's value. SCOPE_IDENTITY() returns the value of the insert in the current scope.

The fix writes SCOPE_IDENTITY(); it is unsafe, since code may rely on the trigger's value on purpose.

From the rule's source, identity_global.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:identity-global" = "warning"

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

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