w3resource

PostgreSQL ARRAY_FILL() function

ARRAY_FILL() function

This function is used to return an array initialized with supplied value and dimensions, optionally with lower bounds other than 1.

Syntax:

array_fill(anyelement, int[], [, int[]])

Return Type:

anyarray

PostgreSQL Version: 9.3

Example: PostgreSQL ARRAY_FILL() function

Code:

SELECT array_fill(7, ARRAY[3], ARRAY[2]);

Sample Output:

  array_fill
---------------
 [2:4]={7,7,7}
(1 row)

Previous: ARRAY_DIMS function
Next: ARRAY_LENGTH function



Follow us on Facebook and Twitter for latest update.