如何安装附加模块pg_trgm


Answers:


22

pg_trgm 是扩展,因此:

CREATE EXTENSION pg_trgm;

如果出现以下错误

错误:无法打开扩展控制文件“ ... / extension / pg_trgm.control”:
无此类文件或目录”

那么您需要为您的操作系统安装模块

  • Ubuntu / Debian:

    sudo apt install postgresql-contrib
  • Redhat / Centos

    sudo dnf install postgresql10-contrib
  • 软呢帽

    sudo dnf install postgresql-contrib

3

1)登录postgres

psql -U <DB_USERNAME>

2)连接后,切换到要为其安装扩展的数据库:

\c <DB_NAME>

3)然后按照前面的回答安装扩展程序:

CREATE EXTENSION pg_trgm;

安装扩展最初给我带来了问题,因为我没有执行步骤2。我以为安装是全局性的,但似乎是每个数据库的安装

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.