fix(db): pin explicit collation in virtual_collections view for MariaDB 11.6+#3759
Merged
gantoine merged 1 commit intoJul 16, 2026
Conversation
…DB 11.6+ On MariaDB 11.6+ the default character_set_collations maps utf8mb4 expressions to uca1400_ai_ci, which clashes with the view's general_ci string literals and JSON_TABLE columns: every /api/collections/virtual request fails with 'Illegal mix of collations ... for operation ='. Recreate the view (new migration, 0095 pattern) with an explicit COLLATE utf8mb4_general_ci on each string output column so comparisons resolve deterministically regardless of server collation defaults. PostgreSQL is unaffected (no-op). Fixes rommapp#3758 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Greptile SummaryThis PR makes the virtual collections view use a stable collation on MariaDB and MySQL. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(db): pin explicit collation in virtu..." | Re-trigger Greptile |
gantoine
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #3758. On MariaDB 11.6+ the default
character_set_collationsmaps utf8mb4 expressions touca1400_ai_ci, which clashes with thevirtual_collectionsview'sgeneral_cistring literals and JSON_TABLE columns: every/api/collections/virtualrequest fails withIllegal mix of collations ... for operation '='and virtual collections disappear from the UI.This adds migration
0096_fix_virtual_collections(following 0095's recreate-the-view pattern) that recreates the MariaDB view with an explicitCOLLATE utf8mb4_general_cion each string output column (5 collection names, 5 type literals, 1 description). An explicit collation has the strongest coercibility, so comparisons resolve deterministically regardless of the server'scharacter_set_collationssetting. The PostgreSQL branch is a no-op (unaffected); downgrade restores the 0095 view verbatim. I pinnedutf8mb4_general_cias the historical default - happy to switch if you'd prefer a different collation.Tested on the affected instance from #3758 (RomM 5.0.0, external MariaDB 11.8.8, 3,158-rom library migrated from 4.9.2): applied this migration's exact SQL, then queried the view in fresh sessions under both the failing default (
utf8mb4=utf8mb4_uca1400_ai_ci) and the legacy mapping (utf8mb4=utf8mb4_general_ci) - all 1,130 virtual collections return correctly in both, and the API returns 200 for every type.First contribution - happy to rework this to your conventions.
AI disclosure per CONTRIBUTING.md: this fix was diagnosed, authored, and tested by an AI (Claude) operating my homelab, with my review. The SQL was generated programmatically from 0095's source (to avoid transcription drift) with the collation pins added, then validated live against the failing environment. PR responses may also be AI-drafted with my review.
Checklist
Screenshots (if applicable)
n/a - API-level fix; traceback and repro steps in #3758