Skip to content

(Postgrex.QueryError) type _geometry can not be handled by the types module GI.PostgresTypes #97

Description

@MartinElvar

I receive the following error after following the installation guide for Ecto.

[error] Postgrex.Protocol (#PID<0.1139.0>) disconnected: ** (Postgrex.QueryError) type `_geometry` can not be handled by the types module GI.PostgresTypes
[info] Sent 500 in 21ms
[error] #PID<0.1401.0> running GIWeb.Endpoint (connection #PID<0.1386.0>, stream id 4) terminated
Server: localhost:4000 (http)
Request: GET /utilities/power
** (exit) an exception was raised:
    ** (Postgrex.QueryError) type `_geometry` can not be handled by the types module GI.PostgresTypes
        (ecto_sql 3.4.5) lib/ecto/adapters/sql.ex:593: Ecto.Adapters.SQL.raise_sql_call_error/1
        (ecto_sql 3.4.5) lib/ecto/adapters/sql.ex:526: Ecto.Adapters.SQL.execute/5
        (ecto 3.4.6) lib/ecto/repo/queryable.ex:192: Ecto.Repo.Queryable.execute/4
        (ecto 3.4.6) lib/ecto/repo/queryable.ex:17: Ecto.Repo.Queryable.all/3
        (elixir 1.11.1) lib/enum.ex:1399: Enum."-map/2-lists^map/1-0-"/2
        .....
Postgrex.Types.define(
  GI.PostgresTypes,
  [Geo.PostGIS.Extension] ++ Ecto.Adapters.Postgres.extensions(),
  json: Jason
)

config :gi, GI.Repo,
  types: GI.PostgresTypes

Not sure why it's trying to use _geometry, and not geometry.

Changing lib/geo_postgis/extension.ex to

  def matching(_) do
    [type: "geometry", type: "geography", type: "_geometry"]
  end

Seems to fix the error.

Activity

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