Skip to content

** (UndefinedFunctionError) function Ch.type/0 is undefined or private. #269

@JVMartyns

Description

@JVMartyns

Repo returns an error when trying to retrieve the subfields of a JSON field using square brackets.
It seems to be an issue with Ecto, but I haven't quite figured out why it's happening yet.
I traced the error back to Ecto's Planner module. Suspect in the validate_json_path! function

How to reproduce:

TestRepo.all(
             from(t in TokenInfoSchema,
               order_by: t.mint,
               select: %{
                 mint: t.mint,
                 name: t.data["nested"]["name"],
                 arr: t.data["nested"]["arr"]
               }
             )
           )
     ** (UndefinedFunctionError) function Ch.type/0 is undefined or private. Did you mean:

         * type/1

     code: assert TestRepo.all(
     stacktrace:
       (ch 0.7.1) Ch.type()
       (elixir 1.19.5) lib/enum.ex:1814: Enum. "-map_reduce/3-lists^mapfoldl/2-0-"/3
       (elixir 1.19.5) lib/enum.ex:1814: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
       (elixir 1.19.5) lib/enum.ex:2520: Enum."-reduce/3-lists^foldl/2-0-"/3
       (ecto 3.13.5) lib/ecto/repo/queryable.ex:223: Ecto.Repo.Queryable.execute/4
       (ecto 3.13.5) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
       test/ecto/integration/json_test.exs:126: (test)

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