Find row limiters without an ORDER BY

Proprietary

A LIMIT, OFFSET, FETCH, or TOP clause selects a subset of rows, but without an ORDER BY the engine is free to return any rows in any order, so the result is arbitrary and can differ from one execution to the next. Queries that can only ever produce a single row, such as a bare aggregate with no GROUP BY, and limiters inside an EXISTS subquery, where order does not matter, are not flagged.

org.openrewrite.sql.antipattern.FindLimitWithoutOrderBy

Optional

markSourceBoolean

Whether to mark each occurrence in source, and apply the fix where the rule remediates. Defaults to true; set to false to leave source untouched and report only to the data table, as an analysis-only pipeline requires.

mod run . --recipe=org.openrewrite.sql.antipattern.FindLimitWithoutOrderBy

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.