A CASE statement has no ELSE, so an unmatched value raises an error

tx0/sql:case-statement-without-elserecommendedwarningreliability/control-flowdepth fastbug

What it finds

A CASE statement without ELSE in PL/SQL, PL/pgSQL or MySQL raises an error ("case not found") when no branch matches, unlike a CASE expression, which gives NULL. An ELSE states what should happen then, even if it is nothing.

From the rule's source, case_statement_without_else.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:case-statement-without-else" = "warning"

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

tx0 explain tx0/sql:case-statement-without-else shows the same in the terminal. Found a false positive? Report it.