Problem with Postgis: (Postgrex.Error) ERROR 58P01 (undefined_file)

why i’m getting this while configuration?

** (Postgrex.Error) ERROR 58P01 (undefined_file) could not open extension control file "/usr/share/postgresql/14/extension/postgis.control": No such file or directory

You probably have to install the postgis extension on Postgres. That error has nothing to do with Elixir. I would start by looking at that and confirm postgis is installed on your database, then circle back to elixir. Try to minimize the surface area for the bugs as you troubleshoot.

1 Like

i am getting this error while running this migration.

defmodule Sportsconnect.Repo.Migrations.EnablePostgisExtension 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

What’s wrong with Geo? can’t we use it for this purpose?

Have you installed postgis?

3 Likes

yes actually i am getting the same error while installing postgis.

Show us how you’re instaling postgis?

3 Likes

yeah i solved this error actually there was a postgres version issue.

Thanks everyone for your help.

Post what you did for others always a good habit :wink:

2 Likes

It’d be useful to get the solution here as I’m having exactly the same problem!

I’m using the official PostGIS docker container, the file seems to exist. Heck, I can psql into the running server and execute the CREATE EXTENSION without error but doing it via the migration seems to blow everything up :slightly_frowning_face:

have you installed Postgis ? if not the following command will work,
sudo apt -y install postgresql-11
sudo apt-get install postgresql-11-postgis-3-scripts

After installing postgis with these commands hopefully you can create postgis extension via migrations file successfully.

1 Like