小编Ian*_*thy的帖子

PostgreSQL EXCLUDE USING 错误:数据类型整数没有默认操作符类

在 PostgreSQL 9.2.3 我试图创建这个简化的表:

CREATE TABLE test (
    user_id INTEGER,
    startend TSTZRANGE,
    EXCLUDE USING gist (user_id WITH =, startend WITH &&)
);
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

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.
Run Code Online (Sandbox Code Playgroud)

PostgreSQL的文档使用这个例子不为我工作:

CREATE TABLE room_reservation (
    room text,
    during tsrange,
    EXCLUDE USING gist (room WITH =, during WITH &&)
);
Run Code Online (Sandbox Code Playgroud)

同样的错误信息。

而这个对我来说也不起作用: …

postgresql constraint installation exclusion-constraint gist-index

47
推荐指数
2
解决办法
3万
查看次数