Error when creating unaccent extension on PostgreSQL

China☆狼群 提交于 2019-12-17 10:52:08

问题


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.


回答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:

  • Does PostgreSQL support "accent insensitive" collations?



回答2:


On CentOS:

sudo yum install postgres*contrib


来源:https://stackoverflow.com/questions/12100638/error-when-creating-unaccent-extension-on-postgresql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!