MaxAffectedRowsAllowedDelete
Last updated: January 22, 2026
Validates DELETE statements against a configurable threshold limit to prevent removing too many rows of data, providing a safety net against runaway deletions that could remove more data than intended and helping ensure bulk delete operations are properly scoped.
Note: This check is not able to evaluate complex multi-statement SQL logic accurately. This limitation is common when analyzing stored logic (e.g., stored procedures, functions, or triggers), but it also applies to any SQL that spans multiple statements or includes procedural logic.
Uses
Property | Value |
Liquibase version required | 4.28.0+ |
Scope (--checks-scope) | changelog |
Default status | enabled |
Default severity (exit code) | 0 ("INFO") |
Customizable settings | Yes (dynamic) |
Known limitation
It is important to know that only UPDATE, INSERT,and DELETE SQL statements will execute when this check triggers and the results are counted to determine if the maxAffectedRowsAllowedDelete triggers or not. If SQL statements exist that are not UPDATE, INSERT,and DELETE, they will not be executed, resulting in unexpected conditions for the check to evaluate. This can lead to false negative and false positive results. It is best to disable any changesets that include multiple SQL statements or are not UPDATE, INSERT,and DELETE when running the MaxAffectedRowsAllowedDelete policy check.
Before you begin
Ensure that you have correctly specified your Liquibase Secure license key.
Ensure that the
--checks-scopeparameter includes the scope of this check.
Changelog checks prerequisites
Procedure
Enable
This check is enabled by default. To verify that it is currently enabled, run the checks show command:
liquibase checks show --check-name=<string>
Customize
This check is dynamic, meaning you can customize its settings. See the table on this page for more information.
1. Once you've enabled the check, follow the steps in the CLI to set new values.
Default values are shown in [brackets]. You can use these by pressing Enter. Alternatively, specify custom values. If a customization setting does not have a default value, you must specify custom values.
2. When finished, verify that your configuration is correct by running the checks show command.
liquibase checks show --check-name=<string>
3. If you need to make any other changes, run the checks customize command:
liquibase checks customize --check-name=<string>
Note: If you want to create another variant of this check with different settings, use the checks copy command to create a copy of the original check and then use the checks customize command to customize it.
Run
To run the check, use the checks run command.
Example output
Check 'maxAffectedRowsAllowedDelete' has been enabled.
+-------------------------------------+------------+----------+----------+--------------------------------+--------------------------------+
| MaxAffectedRowsAllowedDelete | changelog | enabled | 0 | MAX_ROWS = 50 | This checks triggers when the |
| | | | | MESSAGE = <AFFECTED_ROWS> rows | Max Affected Rows Allowed |
| | | | | will be affected, which is | value is exceeded by the |
| | | | | more than the allowed | number of rows DELETED by a |
| | | | | '<THRESHOLD>' rows. The SQL | SQL statement. The SQL |
| | | | | statement is '<STATEMENT>' in | statement is executed against |
| | | | | '<CHANGESET>'. | the database, and then rolled |
| | | | | | back.|
+-------------------------------------+------------+----------+----------+--------------------------------+--------------------------------+
| MaxAffectedRowsAllowedInsert | changelog | disabled | 0 | MAX_ROWS = 50 | This checks triggers when the |
| | | | | MESSAGE = <AFFECTED_ROWS> rows | Max Affected Rows Allowed |
| | | | | will be affected, which is | value is exceeded by the |
| | | | | more than the allowed | number of rows INSERTED by a |
| | | | | '<THRESHOLD>' rows. The SQL | SQL statement. The SQL |
| | | | | statement is '<STATEMENT>' in | statement is executed against |
| | | | | '<CHANGESET>'. | the database, and then rolled |
| | | | | | back.|
+-------------------------------------+------------+----------+----------+--------------------------------+--------------------------------+
| MaxAffectedRowsAllowedUpdate | changelog | disabled | 0 | MAX_ROWS = 50 | This checks triggers when the |
| | | | | MESSAGE = <AFFECTED_ROWS> rows | Max Affected Rows Allowed |
| | | | | will be affected, which is | value is exceeded by the |
| | | | | more than the allowed | number of rows UPDATED by a |
| | | | | '<THRESHOLD>' rows. The SQL | SQL statement. The SQL |
| | | | | statement is '<STATEMENT>' in | statement is executed against |
| | | | | '<CHANGESET>'. | the database, and then rolled |
| | | | | | back.|
+-------------------------------------+------------+----------+----------+--------------------------------+--------------------------------+
Liquibase command 'checks enable' was executed successfully.