Add bit_count SQL function
Peter Eisentraut <peter@eisentraut.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +40 −0 |
| src/backend/utils/adt/varbit.c | modified | +14 −0 |
| src/backend/utils/adt/varlena.c | modified | +11 −0 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +6 −0 |
| src/test/regress/expected/bit.out | modified | +13 −0 |
| src/test/regress/expected/strings.out | modified | +6 −0 |
| src/test/regress/sql/bit.sql | modified | +4 −0 |
| src/test/regress/sql/strings.sql | modified | +2 −0 |
Documentation touched
Discussion
- popcount 19 messages · 2020-12-30 → 2021-03-24