Skip to content

Bit(1) columns not supported as boolean with MyXQL #3061

@KalvinHom

Description

@KalvinHom

Environment

  • Elixir version (elixir -v): 1.9.1
  • Database and version (PostgreSQL 9.4, MongoDB 3.2, etc.): MySQL 5.7.26
  • Ecto version (mix deps): 3.1.7
  • Database adapter and version (mix deps): MyXQL 0.2.6
  • Operating system: macOS 10.13.6

Current behavior

MySQL allows bit(1) to be used as the column type for a boolean. However, Ecto fails to convert it to a boolean with this error:

** (ArgumentError) cannot load <<0::size(1)>> as type :boolean (ecto) lib/ecto/repo/queryable.ex:345: Ecto.Repo.Queryable.process/4 (ecto) lib/ecto/repo/queryable.ex:332: anonymous fn/4 in Ecto.Repo.Queryable.process_kv/4 (elixir) lib/enum.ex:1440: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3 (elixir) lib/enum.ex:1440: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3 (ecto) lib/ecto/repo/queryable.ex:280: Ecto.Repo.Queryable.process/4 (elixir) lib/enum.ex:1440: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3 (elixir) lib/enum.ex:1440: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3 (ecto) lib/ecto/repo/queryable.ex:303: Ecto.Repo.Queryable.process/4 (ecto) lib/ecto/repo/queryable.ex:236: anonymous fn/3 in Ecto.Repo.Queryable.postprocessor/4 (elixir) lib/enum.ex:1336: Enum."-map/2-lists^map/1-0-"/2 (ecto) lib/ecto/repo/queryable.ex:159: Ecto.Repo.Queryable.execute/4 (ecto) lib/ecto/repo/queryable.ex:18: Ecto.Repo.Queryable.all/3 (elixir) lib/enum.ex:1336: Enum."-map/2-lists^map/1-0-"/2 (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3

Expected behavior

Be able to parse bit(1) columns into a boolean

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions