Add bit_count SQL function
This function for bit and bytea counts the set bits in the bit or byte
string. Internally, we use the existing popcount functionality.
For the name, after some discussion, we settled on bit_count, which
also exists with this meaning in MySQL, Java, and Python.
Author: David Fetter <david@fetter.org>
Discussion: https://www.postgresql.org/message-id/flat/20201230105535.GJ13234@fetter.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a6715af1e72da289474011be1e2d536f991eda34
Modified Files
--------------
doc/src/sgml/func.sgml | 40 +++++++++++++++++++++++++++++++++++
src/backend/utils/adt/varbit.c | 14 ++++++++++++
src/backend/utils/adt/varlena.c | 11 ++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 6 ++++++
src/test/regress/expected/bit.out | 13 ++++++++++++
src/test/regress/expected/strings.out | 6 ++++++
src/test/regress/sql/bit.sql | 4 ++++
src/test/regress/sql/strings.sql | 2 ++
9 files changed, 97 insertions(+), 1 deletion(-)