pgsql: Add bit_count SQL function - Mailing list pgsql-committers

From Peter Eisentraut
Subject pgsql: Add bit_count SQL function
Date
Msg-id E1lOdV7-0003lB-Pb@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: pgsql: Add per-index stats information in verbose logs of autovacuum
Next
From: Peter Eisentraut
Date:
Subject: pgsql: pgcrypto: Check for error return of px_cipher_decrypt()