Skip to content

Commit a251f44

Browse files
Merge pull request #1443 from datajoint/fix/1438-json-mariadb-longtext
fix(#1438): preserve json flag for MariaDB longtext-aliased columns
2 parents db42c26 + c3df7b3 commit a251f44

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/datajoint/heading.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,16 @@ def _init_from_database(self) -> None:
508508
if category == "UUID":
509509
attr["uuid"] = True
510510
elif category in CORE_TYPE_NAMES:
511-
# Core type alias - already resolved in DB
512-
pass
511+
# Core type alias - already resolved in DB.
512+
# MariaDB-specific recovery: MariaDB stores `json` columns
513+
# as `longtext` and reports them back that way through
514+
# information_schema, so the DB-type-based detection above
515+
# leaves attr["json"] False. The :json: comment marker
516+
# survives this aliasing, so we recover the json flag here
517+
# from the original declared type. No-op on MySQL/PostgreSQL
518+
# (attr["json"] is already True from the regex match above).
519+
if category == "JSON":
520+
attr["json"] = True
513521

514522
# Check primary key constraints
515523
if attr["in_key"] and (attr["is_blob"] or attr["json"]):

0 commit comments

Comments
 (0)