All Products
Search
Document Center

PolarDB:ST_Contains

Last Updated:Mar 28, 2026

Checks whether a raster object contains another raster object or a geometry object in the same spatial reference system.

Syntax

bool ST_Contains(raster rast1, raster rast2)
bool ST_Contains(raster rast, geometry geom)
bool ST_Contains(geometry geom, raster rast)

Parameters

ParameterDescription
rast1The raster object to test as the container.
rast2The raster object to test as the contained object.
rastA raster object.
geomA geometry object.

Examples

The following example finds all rows in tbl_a whose raster object fully contains the raster objects in tbl_b.

SELECT a.id FROM tbl_a a, tbl_b b WHERE ST_Contains(a.rast, b.rast);

Output:

 id
----
  1
(1 row)

What's next