select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / RANGE/MULTIRANGE FUNCTIONS AND OPERATORS

Returns the non-empty range(s) remaining after subtracting the second range from the first.

Development snapshot. These definitions may change before release.

Signatures & examples

range_minus_multi ( anyrange, anyrange ) → setof anyrange
Returns the non-empty range(s) remaining after subtracting the second range from the first. One row is returned for each range, so if the second range splits the first into two parts, there will be two results. If the subtraction yields an empty range, no rows are returned.
range_minus_multi('[0,10)'::int4range, '[3,4)'::int4range) → [0,3)
[4,10)
Version history 1
  1. PG 18 → 19added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source