所以我有两个整数 > 2 ^ 63 - 1 但 < 2 ^ 64 -1。在大多数语言中这是 BIGINT UNSIGNED,但根据 Comparison of database column types in MySQL, PostgreSQL, and SQLite? (Cross-Mapping) ,它在 postogresql 中是 numeric(20)
问题是,当我尝试在两个未签名的 bigints 之间执行 postgresql 异或运算时:
select 17418945696623429624::numeric(20) # 17418945696623429624::numeric(20);
=>
ERROR: operator does not exist: numeric # numeric
对于任何小于 2 ^ 63 -1 的非“数字”整数,它都可以正常工作。
换句话说:如何在大于 2 ^ 63 - 1 但小于 2 ^ 64 - 1 的两个数字之间执行 XOR 运算?前任。我如何在 PostgreSQL 中将 17418945696623429624 与自身异或?
最佳答案
看起来像PostgreSQL has a bigint type -- 你为什么不使用它?
关于sql - PostgreSQL 中数字之间的异或,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5463950/