select open change scope Open full search

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

FUNCTIONS / ENUM SUPPORT FUNCTIONS

Returns all values of the input enum type in an ordered array.

Signatures & examples

enum_range ( anyenum ) → anyarray
Returns all values of the input enum type in an ordered array.
enum_range(null::rainbow) → {red,orange,yellow,​green,blue,purple}
enum_range ( anyenum, anyenum ) → anyarray
Returns the range between the two given enum values, as an ordered array. The values must be from the same enum type. If the first parameter is null, the result will start with the first value of the enum type. If the second parameter is null, the result will end with the last value of the enum type.
enum_range('orange'::rainbow, 'green'::rainbow) → {orange,yellow,green}
enum_range(NULL, 'green'::rainbow) → {red,orange,​yellow,green}
enum_range('orange'::rainbow, NULL) → {orange,yellow,green,​blue,purple}
Version history 1
  1. PG 12 → 13changed

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