All Products
Search
Document Center

PolarDB:ST_{X|Y|Z|T}Max

Last Updated:Mar 28, 2026

Returns the maximum value of a boxndf bounding box along a specified dimension.

Syntax

float8 ST_XMax(boxndf box);
float8 ST_YMax(boxndf box);
float8 ST_ZMax(boxndf box);
timestamp ST_TMax(boxndf box);

Parameters

ParameterDescription
boxThe boxndf bounding box from which to extract the maximum value.

Return values

ST_XMax, ST_YMax, and ST_ZMax return float8. ST_TMax returns timestamp.

If the bounding box does not have the specified x, y, or z dimension, the function returns NaN. If the bounding box does not have the t dimension, the function returns -infinity.

Examples

Get the maximum T value from a 2D bounding box with a time range:

SELECT ST_TMax(ST_MakeBox2dt(0,0,'2000-01-01'::timestamp, 20,20, '2020-01-01'::timestamp));

Output:

       st_tmax
---------------------
 2020-01-01 00:00:00

Query the Z minimum on the same box, which has no Z dimension — returns NaN:

SELECT ST_ZMin(ST_MakeBox2dt(0,0,'2000-01-01'::timestamp, 20,20, '2020-01-01'::timestamp));

Output:

 st_zmin
---------
     NaN

Query the T minimum on a 2D spatial-only box, which has no T dimension — returns -infinity:

SELECT ST_TMin(ST_MakeBox2D(0,0, 20,20));

Output:

  st_tmin
-----------
 -infinity