From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add bit_count SQL function
Date: Tue, 23 Mar 2021 09:39:01 +0000
Message-ID: <E1lOdV7-0003lB-Pb@gemulon.postgresql.org> (raw)
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: Add bit_count SQL function
In-Reply-To: <E1lOdV7-0003lB-Pb@gemulon.postgresql.org>
References: <E1lOdV7-0003lB-Pb@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox