Skip to content

fix: resolve MariaDB JSON columns showing as binary hex data#484

Merged
datlechin merged 2 commits intomainfrom
fix/mariadb-json-detection
Mar 28, 2026
Merged

fix: resolve MariaDB JSON columns showing as binary hex data#484
datlechin merged 2 commits intomainfrom
fix/mariadb-json-detection

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

  • MariaDB JSON columns were displayed as hex dumps (0x7B2261...) instead of readable JSON text in the data grid, cell editor, and Row Details sidebar
  • Root cause: MariaDB stores JSON as LONGTEXT with utf8mb4_bin collation (charset 46). The driver only checked the BINARY flag to distinguish BLOB from TEXT, but MariaDB sets this flag on any column with a binary collation — including JSON. Fixed by also requiring charsetnr == 63 (true binary charset)
  • Added mariadb_field_attr(MARIADB_FIELD_ATTR_FORMAT_NAME) as best-effort JSON type detection for proper json badge display
  • JSON fields in Row Details sidebar now render in a scrollable monospaced text area instead of a single-line TextField

Test plan

  • 24 unit tests added (MariaDBJsonDetectionTests) covering classifier, blob formatting, cell display, and type properties
  • Connect to MariaDB with JSON columns → verify grid shows readable JSON
  • Select row → Row Details sidebar shows JSON in scrollable textarea
  • Refresh table multiple times → JSON display is consistent (no random toggling)
  • Connect to MySQL → JSON columns still work via type 245
  • Verify real BLOB columns still display as hex

@datlechin datlechin merged commit e0b9793 into main Mar 28, 2026
2 checks passed
@datlechin datlechin deleted the fix/mariadb-json-detection branch March 28, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant