aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2018-12-05 01:56:39 +0300
committerAlexey Shchepin <alexey@process-one.net>2018-12-05 01:56:39 +0300
commit8ebcba4d08f58bfdba192a9d363c36b81ea2ec5a (patch)
treedb310cf887e41edf58fe6a310e1cfe659c586d52
parentProxy protocol may send additional data after addresses (diff)
Fix PostgreSQL compatibility in mod_offline_sql:remove_old_messages (#2695)
-rw-r--r--src/mod_offline_sql.erl13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mod_offline_sql.erl b/src/mod_offline_sql.erl
index c114b1dce..f2cc682d6 100644
--- a/src/mod_offline_sql.erl
+++ b/src/mod_offline_sql.erl
@@ -90,8 +90,17 @@ remove_expired_messages(_LServer) ->
remove_old_messages(Days, LServer) ->
case ejabberd_sql:sql_query(
LServer,
- ?SQL("DELETE FROM spool"
- " WHERE created_at < NOW() - INTERVAL %(Days)d DAY")) of
+ fun(pgsql, _) ->
+ ejabberd_sql:sql_query_t(
+ ?SQL("DELETE FROM spool"
+ " WHERE created_at <"
+ " NOW() - INTERVAL '%(Days)d DAY'"));
+ (_, _) ->
+ ejabberd_sql:sql_query_t(
+ ?SQL("DELETE FROM spool"
+ " WHERE created_at < NOW() - INTERVAL %(Days)d DAY"))
+ end)
+ of
{updated, N} ->
?INFO_MSG("~p message(s) deleted from offline spool", [N]);
_Error ->