我正在尝试在包含名称的文本字段上创建三元组索引。我已将 pg_trgm 扩展添加到架构中。运行\dx
显示已启用:
List of installed extensions
Name | Version | Schema | Description
-----------+---------+------------+-------------------------------------------------------------------
btree_gin | 1.3 | pg_catalog | support for indexing common datatypes in GIN
dblink | 1.2 | wos_core | connect to other PostgreSQL databases from within a database
pg_trgm | 1.4 | wos_core | text similarity measurement and index searching based on trigrams
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(4 rows)
Run Code Online (Sandbox Code Playgroud)
但是,当我运行以下命令时:
CREATE INDEX authors_full_name_idx ON wos_core.interface_table USING GIN (authors_full_name gin_trgm_ops);
Run Code Online (Sandbox Code Playgroud)
我得到以下信息:
ERROR: operator class "gin_trgm_ops" does not exist for access method "gin"
Run Code Online (Sandbox Code Playgroud)
谁能告诉我我做错了什么?
version
---------------------------------------------------------------------------------------------------------
PostgreSQL 11.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
Run Code Online (Sandbox Code Playgroud)
小智 4
该架构wos_core
可能不在您的 search_path 中。
在这种情况下,您需要在运算符前添加模式名称前缀:
创建索引authors_full_name_idx ON wos_core.interface_table 使用 GIN (authors_full_name wos_core .gin_trgm_ops);
或者,您可以更改用户的搜索路径,包括wos_core
:
alter user your_username set search_path = 'public,wos_core,...';
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9543 次 |
最近记录: |