↑↓ select ↵ open ⌫ change scope Open full search

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

Functions / Array Functions And Operators

Sorts the first dimension of the array.

Reading PG 18current·documented in 3 of 27 versions, 18 to 20

Signatures & examples

array_sort ( array anyarray [, descending boolean [, nulls_first boolean ]] ) → anyarray
Sorts the first dimension of the array. The sort order is determined by the default sort ordering of the array's element type; however, if the element type is collatable, the collation to use can be specified by adding a COLLATE clause to the array argument.
array_sort(ARRAY[[2,4],[2,1],[6,5]]) → {{2,1},{2,4},{6,5}}
Version history 1
  1. 17 → 18 added

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