felt / geo

A collection of GIS functions for Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(ArgumentError) no extension found for oid `31600`

asiniy opened this issue · comments

Hey! I think, this issue should be placed here.

I'm trying to store geometry object to database. Unfortunately, I meet this kind of error.

** (ArgumentError) no extension found for oid `38120`: %Postgrex.TypeInfo{array_elem: 0, base_type: 0, comp_elems: [], input: "geometry_in", oid: 38120, output: "geometry_out", receive: "geometry_recv", send: "geometry_send", type: "geometry"}
     stacktrace:
       (postgrex) lib/postgrex/types.ex:272: Postgrex.Types.fetch!/2
       (postgrex) lib/postgrex/types.ex:191: Postgrex.Types.encoder/2
       (elixir) lib/enum.ex:1088: Enum."-map/2-lists^map/1-0-"/2
       (elixir) lib/enum.ex:1088: Enum."-map/2-lists^map/1-0-"/2
       (postgrex) lib/postgrex/query.ex:101: DBConnection.Query.Postgrex.Query.encoders/2
       (postgrex) lib/postgrex/query.ex:48: DBConnection.Query.Postgrex.Query.describe/2
       (db_connection) lib/db_connection.ex:785: DBConnection.describe_execute/4
       (db_connection) lib/db_connection.ex:882: DBConnection.run_begin/3
       (db_connection) lib/db_connection.ex:830: DBConnection.run_meter/3
       (db_connection) lib/db_connection.ex:449: DBConnection.prepare_execute/4
       (postgrex) lib/postgrex.ex:117: Postgrex.query/4
       (ecto) lib/ecto/adapters/postgres/connection.ex:31: Ecto.Adapters.Postgres.Connection.query/4
       (stdlib) timer.erl:197: :timer.tc/3
       (ecto) lib/ecto/adapters/sql.ex:262: Ecto.Adapters.SQL.query/7
       (ecto) lib/ecto/pool.ex:149: Ecto.Pool.run/4
       (ecto) lib/ecto/adapters/sql.ex:247: Ecto.Adapters.SQL.query/6
       (ecto) lib/ecto/adapters/sql.ex:225: Ecto.Adapters.SQL.query/5
       (ecto) lib/ecto/adapters/sql.ex:487: Ecto.Adapters.SQL.model/6
       (ecto) lib/ecto/repo/schema.ex:297: Ecto.Repo.Schema.apply/5
       (ecto) lib/ecto/repo/schema.ex:81: anonymous fn/11 in Ecto.Repo.Schema.do_insert/4

I have a geo 1.0.4. What's going wrong?

Have you enabled the Postgis extension?

From README:

Be sure to enable the Postgis extension if you haven't already done so:

defmodule MyApp.Repo.Migrations.EnablePostgis do
  use Ecto.Migration

  def up do
    execute "CREATE EXTENSION IF NOT EXISTS postgis"
  end

  def down do
    execute "DROP EXTENSION IF EXISTS postgis"
  end
end

Yeah, I did that. Not worked.

Solved by pushing

extensions: [{Geo.PostGIS.Extension, library: Geo}]

to your repo config.