Add width_bucket(anyelement, anyarray).

Enterprise / PostgreSQL - Tom Lane [sss.pgh.pa.us] - 9 September 2014 14:34 UTC

This provides a convenient method of classifying input values into buckets that are not necessarily equal-width. It works on any sortable data type.

The choice of function name is a bit debatable, perhaps, but showing that there's a relationship to the SQL standard's width_bucket() function seems more attractive than the other proposals.

Petr Jelinek, reviewed by Pavel Stehule

e80252d Add width_bucket(anyelement, anyarray).
doc/src/sgml/func.sgml | 33 +++--
src/backend/utils/adt/arrayfuncs.c | 243 ++++++++++++++++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h | 6 +-
src/include/utils/array.h | 1 +
src/test/regress/expected/arrays.out | 123 +++++++++++++++++
src/test/regress/sql/arrays.sql | 62 +++++++++
7 files changed, 458 insertions(+), 12 deletions(-)

Upstream: git.postgresql.org


  • Share