Commit df3f210
fix: MySQL introspection failing on MariaDB servers (#1547)
* Fix MySQL introspection failing on MariaDB servers
Studio's tables introspection aggregated column metadata with
json_arrayagg, which does not exist before MariaDB 10.5 (#1511)
and returns LONGTEXT rather than native JSON on any MariaDB version, while
cast(... as json) is invalid syntax there (#1367).
The MySQL adapter now detects the server flavor once per adapter via
select version() and, on MariaDB, aggregates columns with
coalesce(concat('[', group_concat(json_object(...) separator ','), ']'), '[]')
instead. String-aggregated columns payloads are parsed back into arrays on
the client, which also hardens introspection against MySQL transports that
return json_arrayagg results as strings. Version detection failures fall
back to the existing MySQL SQL.
Verified end-to-end against MariaDB 10.4 and 10.11 containers and the
Vitess-backed MySQL integration suite.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Make MariaDB introspection independent of group_concat_max_len
Addresses PR review feedback: the group_concat-based aggregation was capped
by the session's group_concat_max_len (1MB default on MariaDB, sometimes
configured much lower), which could silently truncate the JSON payload on
very wide tables.
The MariaDB flavor now uses a dedicated tables query
(getMariaDBTablesQuery) that returns one row per column with no JSON
functions and no aggregation at all, and groupMariaDBTablesQueryResult
groups the rows into the aggregated shape on the client. This is immune to
any aggregation size cap and works on every MariaDB version. The MySQL
tables query is restored to its original json_arrayagg form.
Includes a regression test grouping over 1MB of column metadata, and was
verified against MariaDB 10.4/10.11 containers including with
group_concat_max_len lowered to 128 bytes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 3fec72a commit df3f210
5 files changed
Lines changed: 643 additions & 8 deletions
File tree
- .changeset
- data/mysql-core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
151 | 217 | | |
152 | 218 | | |
153 | 219 | | |
154 | 220 | | |
155 | | - | |
| 221 | + | |
156 | 222 | | |
157 | 223 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
163 | 233 | | |
164 | 234 | | |
165 | 235 | | |
| |||
0 commit comments