Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On PostgreSQL 9.2.3 when trying this:


I get this error:

ERROR: could not open extension control file "/opt/local/share/postgresql92/extension/btree_gist.control": No such file or directory

Running SELECT pg_available_extensions(); shows that indeed is not available.

share|improve this question
Googling shows that it's supplied as a .sql file that you run. – Phil Mar 22 '13 at 22:36
Probably, depending on the way you have installed Postgres, there's an extra "contrib" package you need to install – Milen A. Radev Mar 22 '13 at 23:07
up vote 3 down vote accepted

The problem is that the needed contrib files are not installed. This was actually the case for several contrib modules.

I found help with the solution to this here:

$ su
# port build postgresql92
# cd `port work postgresql92`/postgresql-<version>/contrib
# for d in *; do test -d $d && ( echo $d; cd $d; make all && make install; cd .. ); done

I suspect reinstalling everything would work too, but this highlights the actual problem.

share|improve this answer
I recently installed 9.3 (sudo port install postgresql93-server) and uninstalled 9.2 (sudo port uninstall <all related ports>). Today, upon doing a restore I found that CREATE EXTENSION didn't work for this same reason. Executing the above four lines for the appropriate version fixed the problem. – Ian Timothy Sep 12 '13 at 4:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.