Deleting non-existing records does not fail

It looks like the delete task does not fail when attempting to delete non-existing records.

None of the below fails even if there are no records with id 0815 or 98.

<delete tableName="SCHEDULED_JOB">
    <where>id = 0815</where>
</delete>
<sql>
    delete from SCHEDULED_JOB where id = 98
</sql>

This does not feel quite right to me but I see no option to change this behavior. Am I missing something?

Typically deleting a row that doesn’t exist doesn’t cause an error (it might vary for your specific DBMS). If you executed the command it manually, you’ll probably see some variation of “0 rows deleted”.

if you want it to cause an error, you might try a precondition
Preconditions (liquibase.com)
with something like
<sqlCheck expectedResult="1">select count(*) from SCHEDULED_JOB where id = 98</sqlCheck>

1 Like

Sorry, saw your comment too late but the precondition check is exactly what I ended up implementing.