25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Fix PostgreSQL compatibility in mod_offline_sql:remove_old_messages (#2695)

This commit is contained in:
Alexey Shchepin 2018-12-05 01:56:39 +03:00
parent e85fa96cf7
commit 8ebcba4d08

View File

@ -90,8 +90,17 @@ remove_expired_messages(_LServer) ->
remove_old_messages(Days, LServer) -> remove_old_messages(Days, LServer) ->
case ejabberd_sql:sql_query( case ejabberd_sql:sql_query(
LServer, LServer,
?SQL("DELETE FROM spool" fun(pgsql, _) ->
" WHERE created_at < NOW() - INTERVAL %(Days)d DAY")) of 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} -> {updated, N} ->
?INFO_MSG("~p message(s) deleted from offline spool", [N]); ?INFO_MSG("~p message(s) deleted from offline spool", [N]);
_Error -> _Error ->