A window function is used in WHERE, where it cannot be computed

tx0/sql:window-function-in-wheredefaulterrorreliability/logicdepth fastbug

What it finds

WHERE ROW_NUMBER() OVER (...) = 1: window functions are computed after WHERE, so they cannot filter rows there, and the database rejects it. The filter belongs in an outer query over a subquery that computes the window function.

From the rule's source, window_function_in_where.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:

tx0.toml
[rules]
"tx0/sql:window-function-in-where" = "off"

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

tx0 explain tx0/sql:window-function-in-where shows the same in the terminal. Found a false positive? Report it.