Postgrex.Error (undefined_file): could not open extension control file

This was runing in pgsql-9.4, How to resolve this?

11:26:07.637 [info] execute “CREATE EXTENSION citext;”
** (Postgrex.Error) ERROR (undefined_file): could not open extension control file “/usr/pgsql-9.4/share/extension/citext.control”: No such file or directory
(ecto) lib/ecto/adapters/sql.ex:176: Ecto.Adapters.SQL.query!/5
(ecto) lib/ecto/adapters/postgres.ex:69: Ecto.Adapters.Postgres.execute_ddl/3
(ecto) lib/ecto/migration/runner.ex:101: anonymous fn/2 in Ecto.Migration.Runner.flush/0
(elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto) lib/ecto/migration/runner.ex:99: Ecto.Migration.Runner.flush/0
(stdlib) timer.erl:181: :timer.tc/2
(ecto) lib/ecto/migration/runner.ex:27: Ecto.Migration.Runner.run/6
(ecto) lib/ecto/migrator.ex:121: Ecto.Migrator.attempt/6
(ecto) lib/ecto/migrator.ex:71: anonymous fn/4 in Ecto.Migrator.do_up/4
(ecto) lib/ecto/adapters/sql.ex:462: anonymous fn/3 in Ecto.Adapters.SQL.do_transaction/3
(db_connection) lib/db_connection.ex:1079: DBConnection.transaction_run/4
(db_connection) lib/db_connection.ex:1009: DBConnection.run_begin/3
(db_connection) lib/db_connection.ex:766: DBConnection.transaction/3
(ecto) lib/ecto/migrator.ex:227: anonymous fn/4 in Ecto.Migrator.migrate/4
(elixir) lib/enum.ex:1184: Enum."-map/2-lists^map/1-0-"/2
(ecto) lib/mix/tasks/ecto.migrate.ex:70: anonymous fn/4 in Mix.Tasks.Ecto.Migrate.run/2
(elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2
(elixir) lib/enum.ex:651: Enum.each/2
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2

1 Like

You probably need to install this Postgres extension first in the sytem. On Debian/Ubuntu like sytems I think it is in postgresql-contrib-VERSION package you can install with apt-get.

1 Like

Its runing in centos , but Package postgresql-contrib-8.4.20-6.el6.x86_64 already installed and this is the latest version, cant find about the citext info either.

Because it wasn’t in on 8.4. You can either compile it by hand from sources, or upgrade that anciemt version of PostgreSQL somehow.

Yeah postgres 8.4 is from like 7 years ago.

1 Like

Yup, 2009-07-01.

But @php wrote she/he is using version 9.4 in first post so maybe there’s a typo somewhere.

Since there is no postgres 9.4 available in official CentOS 6 repositories (and even CentOS 7 has only postgresql 9.2), I do think the typo has been in the first post, or there are some inofficial repositories in the game.

Isn’t 9.6 out now? Even 9.4 is comparatively pretty old. Newer versions than 9.4 have a lot of security updates, speed improvements, and so forth.

But we are talking about CentOS here, which is one of the slowest but most stable linux distributions I am aware of. AND it is a quasi standard in “enterprise” environments.

Then they should be using versions of software that have the proper security updates. :wink:

1 Like

Don’t argue with the enterprise, they pay my bills… But yes, my company is working hard to get our last CentOS 6 clients updated to CentOS 7.

1 Like

I am sorry to add a question in old post, but I think it is better than making duplicate post.
I just installed Fedora 28 and postgresql 10
I tried to do mix ecto.migrate and got an error says

** (Postgrex.Error) ERROR 58P01 (undefined_file): could not open extension control file “/usr/pgsql-10/share/extension/citext.control”: No such file or directory

I tried pg_config --sharedir and returns

/usr/share/pgsql

and I can find

/usr/share/pgsql/extension/citext.control

file. but not in /usr/pgsql-10/share/extension directory.

I installed postgresql-contrib as @hubertlepicki said…
but it is not working…
What am I missing here?

stupid question: After you installed postgresql-contrib, did you restart postgres server?

Just installed “postgresql10-contrib-10.4-1PGDG.f28.x86_64.rpm” and it works!
Thanks