简体   繁体   English

在PostgreSQL上创建不突出扩展名时出错

[英]Error when creating unaccent extension on PostgreSQL

I am trying to configure PostgreSQL to use fulltext search in my rails app as mentioned in this Railscast . 我正在尝试将PostgreSQL配置为在Rails应用程序中使用全文搜索,如本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 . 我正在使用运行PostgreSQL 9.1.5的全新Ubuntu 12.04服务器,该服务器使用apt-getppa:pitti/postgresql一起安装,带有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用户在psql控制台中尝试相同的命令时,出现以下错误:

postgres=# CREATE EXTENSION unaccent;

ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/unaccent.control": 错误:无法打开扩展控制文件“ /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. 在运行Ubuntu 10.04 desktop本地框中,我使用相同的存储库( natty ),并且运行良好。

Any insights would be greatly appreciated. 任何见解将不胜感激。

You need to install the package postgresql-contrib-9.1 in your system first. 您首先需要在系统中安装软件包postgresql-contrib-9.1 (Adapt to your version number! Here is the currently available list of packages. ) That's the case under Debian , Ubuntu & friends anyway. (适应您的版本号!这是当前可用的软件包列表。 )无论如何,在DebianUbuntu和friends下都是这种情况。 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权限):

sudo apt-get install postgresql-contrib-9.1

Quoting the PostgreSQL Apt Repository : 引用PostgreSQL Apt仓库

If the version included in your version of Debian is not the one you want, you can use the PostgreSQL Apt Repository. 如果Debian版本中包含的版本不是您想要的版本,则可以使用PostgreSQL Apt Repository。

There are basic install instructions on the Postgres website for each available OS. Postgres网站上有每种可用操作系统的基本安装说明

For accent-insensitive indices using unaccent consider this related question: 对于使用不区分重音指数unaccent考虑此相关的问题:

在CentOS上:

sudo yum install postgres*contrib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM