6
我正在从MySQL到Postgres,我在创建索引时遇到了问题。postgres创建索引
CREATE INDEX pointsloc ON table USING gist(point_col);
这是响应我回去:
错误:数据类型的点具有接入方法“要点” 提示没有缺省操作符:必须指定一个操作符的索引或定义一个默认的运营商级为数据类型。
我已经看到我需要指定索引的操作符类,可以使用不同的类,具体取决于您希望在列上使用的操作符的类型。我希望使用@>或〜来查找点是否在多边形内。
我该如何指定操作符类?帮助请必须是一件简单的事情,但我很难过!
编辑
下面是我的打印屏幕试图索引添加到分支表:
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.
编辑我的问题显示打印屏幕和我试图添加索引...请告诉我,我很愚蠢:) –
它可能是您的Postgresql版本。 (我正在运行9.1-beta,它增加了主要索引,所以这可能是我没有得到任何错误的原因。) –
这可能是我在Centos 5.5系统上使用8.1.23。做一个yum更新显示我不能更新到较新的postgres版本.... :(,关于它如何使用8.1.23完成的任何想法。我似乎无法找到任何信息添加运算符类创建索引或甚至哪些我需要做多边形/点搜索lol –