summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index e94c853414..18d8975d15 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -1177,9 +1177,11 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
// the policy table. So it won't be changed/updated
if (messages.messages.is_initialized()) {
utils::dbms::SQLQuery query(db());
- if (!query.Exec(sql_pt::kDeleteMessageString)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from message.");
- return false;
+ if (!messages.messages->empty()) {
+ if (!query.Exec(sql_pt::kDeleteMessageString)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from message.");
+ return false;
+ }
}
if (query.Prepare(sql_pt::kUpdateVersion)) {