At Tue, 9 Feb 2021 15:25:19 +0000, Alexey Bashtanov <bashta...@imap.cc> wrote in > I personally use it as a checksum for a large unordered set, where > performance and simplicity is prioritized over collision resilience. > Maybe there are other ways to use them.
FWIW the BIT_XOR can be created using CREATE AGGREGATE. CREATE OR REPLACE AGGREGATE BIT_XOR(IN v smallint) (SFUNC = int2xor, STYPE = smallint); CREATE OR REPLACE AGGREGATE BIT_XOR(IN v int4) (SFUNC = int4xor, STYPE = int4); CREATE OR REPLACE AGGREGATE BIT_XOR(IN v bigint) (SFUNC = int8xor, STYPE = bigint); CREATE OR REPLACE AGGREGATE BIT_XOR(IN v bit) (SFUNC = bitxor, STYPE = bit); The bit_and/bit_or aggregates are back to 2004, that commit says that: > commit 8096fe45cee42ce02e602cbea08e969139a77455 > Author: Bruce Momjian <br...@momjian.us> > Date: Wed May 26 15:26:28 2004 +0000 ... > (2) bitwise integer aggregates named bit_and and bit_or for > int2, int4, int8 and bit types. They are not standard, but I find > them useful. I needed them once. We already had CREATE AGGREATE at the time, so BIT_XOR can be thought as it falls into the same category with BIT_AND and BIT_OR, that is, we may have BIT_XOR as an intrinsic aggregation? regards. -- Kyotaro Horiguchi NTT Open Source Software Center