APPLY_SUM

Computes the sum of all elements in a.

Computes the sum of all elements in a collection (array or set).

Behavior type

Immutable

Syntax

APPLY_SUM(collection)

Arguments

collection
Target collection

Supported data types

1D collections of:

  • INTEGER

  • FLOAT

  • NUMERIC

  • INTERVAL

Null-handling

The following cases return NULL:

  • if the input collection is NULL

  • if the input collection contains only null values

  • if the input collection is empty

Examples

=> SELECT apply_sum(ARRAY[12.5,3,4,1]);
apply_sum
-----------
      20.5
(1 row)

See also