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.

  • Googling shows that it's supplied as a .sql file that you run.
    – Philᵀᴹ
    Commented Mar 22, 2013 at 22:36
  • Probably, depending on the way you have installed Postgres, there's an extra "contrib" package you need to install Commented Mar 22, 2013 at 23:07

1 Answer 1


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.

  • 2
    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. Commented Sep 12, 2013 at 4:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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