Error when creating unaccent extension on PostgreSQL

23,530

Solution 1

You need to install the package postgresql-contrib-9.1 in your system first. (Adapt to your version number! Here is the currently available list of packages.) That's the case under Debian, Ubuntu & friends anyway. Using a system user with the necessary privileges:

apt-get install postgresql-contrib-9.1

If your currently logged in user does not have the necessary privileges (but sudo rights):

sudo apt-get install postgresql-contrib-9.1

Quoting the PostgreSQL Apt Repository:

If the version included in your version of Debian is not the one you want, you can use the PostgreSQL Apt Repository.

There are basic install instructions on the Postgres website for each available OS.

For accent-insensitive indices using unaccent consider this related question:

Solution 2

On CentOS:

sudo yum install postgres*contrib
Share:
23,530
fagiani
Author by

fagiani

Love taking care of legacy software of any kind, flavor, language or framework with all of its dependencies. Optimize, transform, enable, migrate, improve, rearchitect, reduce cost, sustain, operate, support. Not necessarily evolve but interact, learn, instruct and contribute with whoever does or wants to.

Updated on March 29, 2020

Comments

  • fagiani
    fagiani about 4 years

    I am trying to configure PostgreSQL to use fulltext search in my rails app as mentioned in this Railscast.

    I am using a fresh Ubuntu 12.04 server running PostgreSQL 9.1.5 installed using apt-get with the ppa:pitti/postgresql with precise.

    I get the following error when trying to run the migration and when I try the same command in the psql console with the peer postgres user:

    postgres=# CREATE EXTENSION unaccent;
    

    ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/unaccent.control":
    No such file or directory

    In my local box running Ubuntu 10.04 desktop I use the same repository (natty) and it works well.

    Any insights would be greatly appreciated.

  • user3005501
    user3005501 about 10 years
    Fedora Users: yum install postgresql-contrib
  • Dan King
    Dan King about 10 years
    I've just tried that on Centos 6.4 and got this message: "No package postgres*contrib available".
  • Erwin Brandstetter
    Erwin Brandstetter almost 10 years
    @AlterLagos: You need sudo, if your currently logged in user does not have the necessary privileges (but sudo rights).
  • Alter Lagos
    Alter Lagos almost 10 years
    Yep, but that was not the big change. For you worked with postgresql-contrib-9.1 but that package was not available for me, instead I use postgresql-contrib and worked like a charm. I guess it should be because I'm using the official repo as source http://apt.postgresql.org/pub/repos/apt/
  • Jigar Bhatt
    Jigar Bhatt over 8 years
    this command works for me sudo apt-get install postgresql-contrib-9.3