RefLib

Reference library for AI

Back

postgresql_16:6.1.2.2 Container Types

PostgreSQL 16 > Server Programming > Extending SQL > The PostgreSQL Type System > Container Types

PostgreSQL has three kinds of “container” types, which are types that contain multiple values of other types. These are arrays, composites, and ranges.

Arrays can hold multiple values that are all of the same type. An array type is automatically created for each base type, composite type, range type, and domain type. But there are no arrays of arrays. So far as the type system is concerned, multi-dimensional arrays are the same as one-dimensional arrays. Refer to (see postgresql_16:3.5.15) for more information.

Composite types, or row types, are created whenever the user creates a table. It is also possible to use (see postgresql_16:7.1.92) to define a “stand-alone” composite type with no associated table. A composite type is simply a list of types with associated field names. A value of a composite type is a row or record of field values. Refer to (see postgresql_16:3.5.16) for more information.

A range type can hold two values of the same type, which are the lower and upper bounds of the range. Range types are user-created, although a few built-in ones exist. Refer to (see postgresql_16:3.5.17) for more information.

Back