Skip to content

MySQL unparser emits CAST(x AS TINYINT), which MySQL rejects #26882

Closed

Description

@hozan23

Describe the bug

MySqlDialect overrides int32_cast_dtype and int64_cast_dtype to return SIGNED, but does not override int8_cast_dtype. An Int8 cast therefore unparses with the default TINYINT.

MySQL's CAST does not accept TINYINT as a target type (see the permitted types).

To Reproduce

let unparser = Unparser::new(&MySqlDialect {});
let expr = Expr::Cast(Cast::new(Box::new(col("a")), DataType::Int8));
println!("{}", unparser.expr_to_sql(&expr)?);
// CAST(`a` AS TINYINT)

Expected behavior

CAST(a AS SIGNED), the same as Int32 and Int64 casts.

Additional context

No response

Willingness to contribute

I plan to contribute a fix for this bug independently

Activity

  1. added theissue type on Oct 29, 2026
  2. added a commit that references this issue on Nov 1, 2026
    68ac6cc
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

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions