[SQL] Better logging when applying rules.