fix mysql introspection json columns#1495
Conversation
|
@sorenbs Why has this serious error remained unresolved for such a long time? |
|
Hi @aiprojectchiwa — thanks for digging into this and for the clean regression test. Since this was opened we root-caused the MariaDB failures further: the introspection SQL itself is invalid on MariaDB ( |
|
Closing as discussed — #1547 has landed on main with the SQL-level MariaDB fix (one row per column, no aggregation) plus transport-agnostic string-payload normalization covering the case you diagnosed. Thanks again @aiprojectchiwa for moving this forward; the string-payload observation genuinely helped pin down the root cause. |

Summary
Fix MySQL/MariaDB introspection in Prisma Studio when the introspection query returns aggregated
columnsas a JSON string instead of an array.This prevents Studio from crashing with errors like:
a.sort is not a functioncolumns.sort is not a functionRoot cause
Some MySQL-compatible backends (notably MariaDB variants) can return the
json_arrayagg(...)result as a string payload. The adapter assumedcolumnswas always already an array and called.sort()directly.Fix
columnsbefore sortingVerification
Validated on Node
24.13.0with:pnpm typecheckpnpm exec eslint data/mysql-core/adapter.ts data/mysql-core/introspection-hardening.test.tspnpm test:datapnpm buildpnpm check:exports