All Products
Search
Document Center

PolarDB:ST_union

Last Updated:Mar 28, 2026

Merges an array of pcpatch entries into a single pcpatch object.

Syntax

pcpatch ST_Union(pcpatch[] pcs);

Parameters

ParameterDescription
pcsThe pcpatch array.

Examples

The following example compares the total point count computed by aggregating patches first (ST_Union) against the sum of per-patch point counts (ST_NumPoints). Both queries return 100.

-- Compare npoints(sum(patches)) with sum(npoints(patches)).
SELECT ST_NumPoints(ST_Union(pa)) FROM patches;
SELECT Sum(ST_NumPoints(pa)) FROM patches;

100