Re: popcount

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: David Fetter <david@fetter.org>, Daniel Verite <daniel@manitou-mail.org>, PostgreSQL Development <pgsql-hackers@postgresql.org>, Vik Fearing <vik.fearing@2ndquadrant.com>
Date: 2021-01-18T15:34:10Z
Lists: pgsql-hackers
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> [ assorted nits ]

At the level of bikeshedding ... I quite dislike using the name "popcount"
for these functions.  I'm aware that some C compilers provide primitives
of that name, but I wouldn't expect a SQL programmer to know that;
without that context the name seems pretty random and unintuitive.
Moreover, it invites confusion with SQL's use of "pop" to abbreviate
"population" in the statistical aggregates, such as var_pop().

Perhaps something along the lines of count_ones() or count_set_bits()
would be more apropos.

			regards, tom lane



Commits

  1. Add bit_count SQL function