Document if width_bucket's low and high are inclusive/exclusive

2025-02-28 Thread Ben Peachey Higdon
The current documentation for width_bucket 
(https://www.postgresql.org/docs/current/functions-math.html 
) does not mention 
if the range’s low and high are inclusive or exclusive.

> Returns the number of the bucket in which operand falls in a histogram having 
> count equal-width buckets spanning the range low to high. Returns 0 or 
> count+1 for an input outside that range.


I had assumed that both the low and high were inclusive but actually the low is 
inclusive while the high is exclusive.

For example:
SELECT width_bucket(0, 0, 1, 4)

returns 1, the first of 4 bins

SELECT width_bucket(1, 0, 1, 4) 

returns 5, because the high was outside the exclusive bound of high = 1

Thank you!

Re: Regarding explanation to store and retrieve postgres geometric features

2025-02-28 Thread Euler Taveira
On Fri, Feb 7, 2025, at 7:43 AM, PG Doc comments form wrote:
> Page: https://www.postgresql.org/docs/17/datatype-geometric.html
> Description:
> 
> I have found section for 8.8. Geometric Types 
> 8.8.1. Points
> 8.8.2. Lines
> 8.8.3. Line Segments
> 8.8.4. Boxes
> 8.8.5. Paths
> 8.8.6. Polygons
> 8.8.7. Circles but dont find how to use it and test it. can you add a
> detailed explanation or provide some references.
> 

This page says

A rich set of functions and operators is available to perform various geometric
operations such as scaling, translation, rotation, and determining
intersections. They are explained in Section 9.11.

Hence, check the referred section.


--
Euler Taveira
EDB   https://www.enterprisedb.com/