我试图在包含名字的文本上创建一个trigram索引。我已经将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)
但是,当我运行以下命令时:
CREATE INDEX authors_full_name_idx ON wos_core.interface_table USING GIN (authors_full_name gin_trgm_ops);
我得到以下信息:
ERROR: operator class "gin_trgm_ops" does not exist for access method "gin"
有人能告诉我我做错了什么吗?
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
发布于 2022-08-04 18:21:49
我在这里找到了解决方案,https://github.com/PostgresApp/PostgresApp/issues/335,在我的例子中,我不得不删除扩展:
drop extension if exists pg_trgm;
然后我又用这个创建了它:
create extension pg_trgm with schema [schemaName];
发布于 2021-06-28 03:02:30
好吧,对我来说,我使用的postgres版本是不同的--一旦我升级到更高的版本--它对我来说很好--对于上下文来说,我在执行db:迁移时得到了这个结果。仅供参考
https://dba.stackexchange.com/questions/234463
复制相似问题