aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-07-22 19:09:50 +0200
committerKim Alvefur <zash@zash.se>2022-07-22 19:09:50 +0200
commit2dbbce23823edbf4261df92175d7ee9cf7cca3a9 (patch)
tree6c13fae84a5f7e6bb1edbe53763cafc971ddf981 /plugins
parent3ee6df83b0ef2070928140bd6fb2c4318e594bfb (diff)
downloadprosody-2dbbce23823edbf4261df92175d7ee9cf7cca3a9.tar.gz
prosody-2dbbce23823edbf4261df92175d7ee9cf7cca3a9.zip
mod_storage_sql: Fix summary API with Postgres (fixes #1766)
The ORDER BY and LIMIT clauses are not needed and don't even make much sense. This part was most likely a leftover from the :find method. Tested with sqlite and postgres 14
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_storage_sql.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 448eaa2d..f941025e 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -544,8 +544,7 @@ function archive_store:summary(username, query)
SELECT DISTINCT "with", COUNT(*), MIN("when"), MAX("when")
FROM "prosodyarchive"
WHERE %s
- GROUP BY "with"
- ORDER BY "sort_id" %s%s;
+ GROUP BY "with";
]];
local args = { host, user or "", store, };
local where = { "\"host\" = ?", "\"user\" = ?", "\"store\" = ?", };
@@ -558,8 +557,7 @@ function archive_store:summary(username, query)
args[#args+1] = query.limit;
end
- sql_query = sql_query:format(t_concat(where, " AND "), query.reverse
- and "DESC" or "ASC", query.limit and " LIMIT ?" or "");
+ sql_query = sql_query:format(t_concat(where, " AND "));
return engine:select(sql_query, unpack(args));
end);
if not ok then return ok, result end