Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MartinElvar opened this issue Nov 27, 2020 · 1 comment

Comments

@MartinElvar
Copy link

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.

@atomkirk
Copy link

I had the same error. I upgraded to 3.4 and now it appears fixed?

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

No branches or pull requests

2 participants