相当于由整数和范围组成的排除约束 [英] Equivalent to exclusion constraint composed of integer and range
本文介绍了相当于由整数和范围组成的排除约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个等同于排除
约束的东西
I need to have something equivalent to this exclusion
constraint
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.
我猜这个错误消息很明显。如何做?
I guess the problem is obvious from the error message. How to do it?
推荐答案
您需要安装附加模块 btree_gist
You need to install the additional module btree_gist
to make it work. The module installs the missing operator class.
此相关答案中的详细信息:
对具有按位AND运算符的位字符串列的排除约束
Details in this related answer:
Exclusion constraint on a bitstring column with bitwise AND operator
在dba.SE的此答案更多:
PostgreSQL EXCLUDE USING错误:数据类型整数没有默认运算符类
More at this answer on dba.SE:
PostgreSQL EXCLUDE USING error: Data type integer has no default operator class
这篇关于相当于由整数和范围组成的排除约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文