我已将一个 intarray 列添加到我的表中,并成功地将数据添加到该列中。
CREATE TABLE my_table
(
...
tag_ids integer[],
)
当我尝试这样的查询时:
SELECT id, tag_ids from my_table where tag_ids @@ ARRAY[1,2]
我收到此错误:
ERROR: operator does not exist: integer[] @@ integer[]
LINE 1: SELECT id, tag_ids from core_tile where tag_ids @@ ARRAY[1,2...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
我通过 Homebrew for OS X 安装了 9.3,我相信它包含该intarray
模块,就像我说的那样,我添加了数组列和数据没问题。还有这个:
SELECT * FROM pg_available_extensions
...
"intarray";"1.0";"";"functions, operators, and index support for 1-D arrays of integers"
更新:
我想知道在操作员工作之前是否需要一个特定的索引。在文档的示例中,他们添加了如下索引:
CREATE INDEX my_index ON my_table USING GIST (tag_ids gist__int_ops);
但是当我运行时,我得到:
ERROR: operator class "gist__int_ops" does not exist for access method "gist"
我是否缺少扩展名或查询有问题或什么?