在PostgreSQL 9.2中,我创建一个具有地理(postGIS)类型和整数作为复合索引的索引没有问题。但是现在(9.6)它抱怨创建索引,我不明白它提供的提示:
列和数据均已正确创建,Postgres抱怨创建索引。
ERROR: data type integer 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.
********** Error**********
ERROR: data type integer has no default operator class for access method "gist"
SQL state: 42704
Hint: You must specify an operator class for the index
or define a default operator class for the data type.
模式定义如下:
- Table: portal.inventory
-- DROP TABLE portal.inventory;
CREATE TABLE portal.inventory
(
type character varying,
pid integer,
size bigint,
date timestamp without time zone,
path character varying,
outline geography(Polygon,4326)
)
WITH (
OIDS=FALSE
);
ALTER TABLE portal.inventory
OWNER TO postgres;
-- Index: portal.inventory_compound_idx
-- DROP INDEX portal.inventory_compound_idx;
CREATE INDEX inventory_compound_idx
ON portal.inventory
USING gist
(outline, pid);
-- Index: portal.inventory_icompound_idx
-- DROP INDEX portal.inventory_icompound_idx;
CREATE INDEX inventory_icompound_idx
ON portal.inventory
USING gist
(pid, outline);