Description
Elixir version
v1.17.3
Database and Version
MariaDB v11.5.2
Ecto Versions
ecto 3.11.2, ecto_sql 3.11.2
Database Adapter and Versions (postgrex, myxql, etc)
myxql 0.6.4
Current behavior
In the error_tracker we use a field of type {:array, :string}
for the list opdf breadcrumbs of an occurrence (source).
As we support all three major SQL databases (PostgreSQL, SQLite and MySQL/MariaDB), we need to implement the schema for all of them, so in the case of MySQL/MariaDB we implemented that field as a :json
column (at the end, a list of strings is a valid JSON).
It work as expecrted for MySQL, which implements the JSON column type. However, for MariaDB it does nopt work because it implements JSON columns as longtext
columns, and on runtime it breaks with:
** (ArgumentError) cannot load `"[]"` as type {:array, :string} for field :breadcrumbs in %ErrorTracker.Occurrence{__meta__: #Ecto.Schema.Metadata<:loaded, "error_tracker_occurrences">, id: nil, reason: nil, context: nil, breadcrumbs: nil, stacktrace: nil, error_id: nil, error: #Ecto.Association.NotLoaded<association :error is not loaded>, inserted_at: nil}
The original issue can be found here
Expected behavior
I would expect it to load the content using a JSON parser, the same way it does for a :map
field.