select open change scope Open full search

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

FUNCTIONS / ARRAY FUNCTIONS AND OPERATORS

Returns an array filled with copies of the given value, having dimensions of the lengths specified by the second argument.

Signatures & examples

array_fill ( anyelement, integer[] [, integer[] ] ) → anyarray
Returns an array filled with copies of the given value, having dimensions of the lengths specified by the second argument. The optional third argument supplies lower-bound values for each dimension (which default to all 1).
array_fill(11, ARRAY[2,3]) → {{11,11,11},{11,11,11}}
array_fill(7, ARRAY[3], ARRAY[2]) → [2:4]={7,7,7}
Version history 2
  1. PG 12 → 13changed
  2. PG 9.2 → 9.3changed

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