From 88a3b32d427de8621afbbb1ff54ee9ce557a43ca Mon Sep 17 00:00:00 2001 From: Dessan Hemrayev <43703214+dessanhemrayev@users.noreply.github.com> Date: Thu, 9 Oct 2025 11:25:54 +0300 Subject: [PATCH] fixes #265: Ensure cross-database compatibility for unread message count query In the "ofpresence" table, the "offlineDate" field has the data type "VARCHAR/CHAR" depending on the database, and in the query we are trying to compare this field with the "sentDate" field, which has the data type "BIGINT/INTEGER". This results in the following error: ``` ERROR: operator does not exist: bigint > character varying LINE 3: JOIN ofPresence p ON (a.sentDate > p.offlineDate) HINT: No operator matches the given name and argument types. You might need to add explicit type casts. ``` This change replaces implicit comparison with explicit, database-specific CAST expressions. The correct CAST is selected at runtime based on the underlying database (MySQL, PostgreSQL, SQL Server, Oracle, Sybase), ensuring reliable and portable behavior across all Openfire-supported DBs. --- changelog.html | 1 + .../rest/controller/MsgArchiveController.java | 30 +++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/changelog.html b/changelog.html index 8a463878d..4c3de09d6 100644 --- a/changelog.html +++ b/changelog.html @@ -47,6 +47,7 @@

1.12.1 (to be determined)