我将从
mysql转到postgres,我在创建索引时遇到问题.
CREATE INDEX pointsloc ON table USING gist(point_col);
错误:数据类型点没有访问方法“gist”的默认运算符类
提示:您必须为索引指定运算符类,或者为数据类型定义默认运算符类.
我已经看到我需要为索引指定运算符类,可以使用不同的类,具体取决于您希望在列上使用的运算符的类型.我希望使用@>或〜来查找一个点是否在多边形内.
我如何指定运算符类?帮助请一定是一件简单的事情,但我很难过!
编辑
下面是我尝试向分支表添加索引的打印屏幕:
Table "public.branch" Column | Type | Modifiers ------------------+------------------+----------------------------------------------------- id | integer | not null default nextval('branch_id_seq'::regclass) name | character(120) | center_point_lat | double precision | center_point_lng | double precision | center_point | point | Indexes: "branch_pkey" PRIMARY KEY,btree (id) paul=# create index pt_idx on branch using gist (center_point); ERROR: data type point has no default operator class for access method "gist" HINT: You must specify an operator class for the index or define a default operator class for the data type.
我尝试时似乎工作正常:
test=# create table test (pt point); CREATE TABLE test=# create index pt_idx on test using gist (pt); CREATE INDEX
你确定你的point_col实际上是类型点吗?因为,如果它是一个varchar,那么在没有btree_gist contrib的情况下它确实会失败 – 即便如此它也不会非常有用.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。