Skip to content

MariaDB version 11 is incompatible with MySQL - String columns are detected as Dec64 #208

Closed

Description

@hhaensel

column types are not correctly inferred when updating mariadb to version 11.
It's probably worthwhile switching to the latest mariadb c connector
with MariaDB Server 10:

julia> DataFrame(DBInterface.execute(conn, "select * from `benutzer`"))
2×1 DataFrame
 Row │ uname
     │ String?
─────┼─────────
   1 │ test
   2 │ rest

with MariaDB Server 11:

julia> DBInterface.execute(conn, "select * from `benutzer`") |> DataFrame
ERROR: ArgumentError: invalid number format test
Stacktrace:
  [1] parse(#unused#::Type{DecFP.Dec64}, s::String)
    @ DecFP C:\Users\helmu\.julia\packages\DecFP\Cud5F\src\DecFP.jl:323

If I store strings that can be parsed as numbers in the field 'uname' the columns are indeed read as Dec64.

julia> DataFrame(hh)
3×1 DataFrame
 Row │ uname
     │ Dec64
─────┼───────
   1 │  10.0
   2 │  11.0
   3 │  14.0

This behaviour is consistent with the (wrong) column type stored in the query result:

julia> res = DBInterface.execute(conn, "select * from `benutzer`");

julia> res.types
1-element Vector{Type}:
 Union{Missing, DecFP.Dec64}

Activity

  1. pascalr0410 commented on Aug 11, 2023

    @pascalr0410
    Contributor

    Hello,

    Same here, must fall back on branch 10 of MariaDb.

    The C Lib used seems quite old, released in December. 2019.

    In fact, after some debugging, the library returns a zero in field_type, causing it to be misinterpreted as Dec64

    /src/MySQL.jl

    # --> Here, the real type is VARCHAR
    
    function juliatype(field_type, notnullable, isunsigned, isbinary, date_and_time)
        @info field_type # --> 0
        T = API.juliatype(field_type)
        @info T # --> Dec64
        T2 = isunsigned && !(T <: AbstractFloat) ? unsigned(T) : T
        T3 = !isbinary && T2 == Vector{UInt8} ? String : T2
        T4 = date_and_time && T3 <: DateTime ? DateAndTime : T3
        return notnullable ? T4 : Union{Missing, T4}
    end
    

    Regards,
    Pascal.

  2. quinnj commented on Sep 9, 2026

    @quinnj
    Member

    Fixed in v2.0.0. Column types now come from the wire column definitions rather than the C connector's field reports; mariadb:11.4 is a CI lane. String columns decode to DataString and DECIMAL columns to MySQL.DecimalResult (exact). Migration guide: https://github.com/JuliaDatabases/MySQL.jl/blob/main/docs/src/migration.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions