等价于由整数和范围组成的排除约束 [英] Equivalent to exclusion constraint composed of integer and range

查看:21
本文介绍了等价于由整数和范围组成的排除约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有与这个 exclusion 约束等价的东西

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 EXCLUDEUSING 错误:数据类型整数没有默认运算符类

More at this answer on dba.SE:
PostgreSQL EXCLUDE USING error: Data type integer has no default operator class

这篇关于等价于由整数和范围组成的排除约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆