相当于由整数和范围组成的排除约束

时间:2014-01-03 16:44:44

标签: postgresql operators range constraints postgresql-9.3

我需要具有与此exclusion约束相等的内容

drop table if exists t;
create table t (
    i int,
    tsr tstzrange,
    exclude using gist (i with =, tsr with &&)
);
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.

我猜错误信息显而易见。怎么做?

1 个答案:

答案 0 :(得分:4)

您需要安装附加模块btree_gist才能使其正常运行。该模块安装了缺少的操作符类。

此相关答案的详情:
Exclusion constraint on a bitstring column with bitwise AND operator

更多关于dba.SE的回答:
PostgreSQL EXCLUDE USING error: Data type integer has no default operator class