fix: Ensure cross-database compatibility for unread message count query - #216
Conversation
|
Hi @Fishbowler , @guusdk |
|
Hi @guusdk |
72c10b5 to
2d7fada
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Cross-database SQL behavior warrants final human validation.
Review effort: Lite
Findings: None
What changed in this PR
Updates unread-message counting with database-specific casts for cross-database compatibility.
Changes:
- Adds runtime database-aware SQL casting.
- Uses the generated query for unread counts.
- Updates plugin metadata and changelog.
| File | Description |
|---|---|
src/java/org/jivesoftware/openfire/plugin/rest/controller/MsgArchiveController.java |
Adds database-specific casting to the unread-count query. |
plugin.xml |
Updates the plugin date. |
changelog.html |
Documents the compatibility fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ead 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.
2d7fada to
88a3b32
Compare
|
Warning Review limit reachedNext included review available in 8 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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:
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.
fixes #265