Skip to content

[pull] master from postgres:master #984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions doc/src/sgml/func.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -1824,13 +1824,23 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in
which <parameter>operand</parameter> falls in a histogram
having <parameter>count</parameter> equal-width buckets spanning the
range <parameter>low</parameter> to <parameter>high</parameter>.
Returns <literal>0</literal>
The buckets have inclusive lower bounds and exclusive upper bounds.
Returns <literal>0</literal> for an input less
than <parameter>low</parameter>,
or <literal><parameter>count</parameter>+1</literal> for an input
outside that range.
greater than or equal to <parameter>high</parameter>.
If <parameter>low</parameter> &gt; <parameter>high</parameter>,
the behavior is mirror-reversed, with bucket <literal>1</literal>
now being the one just below <parameter>low</parameter>, and the
inclusive bounds now being on the upper side.
</para>
<para>
<literal>width_bucket(5.35, 0.024, 10.06, 5)</literal>
<returnvalue>3</returnvalue>
</para>
<para>
<literal>width_bucket(9, 10, 0, 10)</literal>
<returnvalue>2</returnvalue>
</para></entry>
</row>

Expand All @@ -1842,8 +1852,8 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in
<para>
Returns the number of the bucket in
which <parameter>operand</parameter> falls given an array listing the
lower bounds of the buckets. Returns <literal>0</literal> for an
input less than the first lower
inclusive lower bounds of the buckets.
Returns <literal>0</literal> for an input less than the first lower
bound. <parameter>operand</parameter> and the array elements can be
of any type having standard comparison operators.
The <parameter>thresholds</parameter> array <emphasis>must be
Expand Down
4 changes: 2 additions & 2 deletions src/backend/utils/adt/float.c
Original file line number Diff line number Diff line change
Expand Up @@ -4065,8 +4065,8 @@ float84ge(PG_FUNCTION_ARGS)
* in the histogram. width_bucket() returns an integer indicating the
* bucket number that 'operand' belongs to in an equiwidth histogram
* with the specified characteristics. An operand smaller than the
* lower bound is assigned to bucket 0. An operand greater than the
* upper bound is assigned to an additional bucket (with number
* lower bound is assigned to bucket 0. An operand greater than or equal
* to the upper bound is assigned to an additional bucket (with number
* count+1). We don't allow "NaN" for any of the float8 inputs, and we
* don't allow either of the histogram bounds to be +/- infinity.
*/
Expand Down
7 changes: 4 additions & 3 deletions src/backend/utils/adt/numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -1958,9 +1958,10 @@ generate_series_numeric_support(PG_FUNCTION_ARGS)
* in the histogram. width_bucket() returns an integer indicating the
* bucket number that 'operand' belongs to in an equiwidth histogram
* with the specified characteristics. An operand smaller than the
* lower bound is assigned to bucket 0. An operand greater than the
* upper bound is assigned to an additional bucket (with number
* count+1). We don't allow "NaN" for any of the numeric arguments.
* lower bound is assigned to bucket 0. An operand greater than or equal
* to the upper bound is assigned to an additional bucket (with number
* count+1). We don't allow "NaN" for any of the numeric inputs, and we
* don't allow either of the histogram bounds to be +/- infinity.
*/
Datum
width_bucket_numeric(PG_FUNCTION_ARGS)
Expand Down