Array types
Array
a set of numbered elements of the same type
one-dimensional, multidimensional
Initialization
usage without an explicit declaration (type_name[])
implicit declaration when creating a base type or a table (_type_name)
Usage
elements as scalar values
array slices
operations on arrays: comparison, inclusion, intersection, concatenation,
usage with ANY or ALL instead of a subquery, etc.
Just like a composite type (a record), an array is not a scalar; it consists of
several elements of another type. But unlike in records, a) all these
elements are of the same type, and b) they are accessed by an integer
index, not by name (here the term index is used in the mathematical sense
of the word, not in the sense of a database index).
An array type does not have to be explicitly declared. When any base type
or a table is created, a new array type is also declared. Its name is the same
as the original type name, but with an underscore in front: _type_name. To
declare an array variable, all you need is to append square brackets to the
name of the element type.
An array is a full-fledged SQL type: you can create table columns of this
type, pass arrays as function arguments, and so on. Array elements can be
used as regular scalar values. Array slices can also be used.
Arrays can be compared and checked for NULL; you can search arrays for
element inclusion and intersection with other arrays, perform concatenation,
etc. Arrays can also be applied in ANY/SOME and ALL constructs, similar to
subqueries.
https://postgrespro.com/docs/postgresql/17/arrays
You can find various array functions in course handouts.