Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我找不到如何将xid(事务 ID 类型)列设置为在表中是唯一的。它抱怨 btree 缺少类方法,我不知道如何解决它。
xid
这是使用 PostgreSQL 9.0。
在这些论坛或互联网上找不到任何类似的问题。:-(
原因是没有<>为数据类型定义运算符xid(等等)。尝试:
<>
SELECT '123'::xid <> '123'::xid
失败。 您可以通过添加这样的唯一索引来规避此限制:
CREATE UNIQUE INDEX tbl_xid_col_uni_idx ON tbl (cast(cast(xid_col AS text) AS int));