Enumerations are probably the simplest data type you can create; they handle a specific set of allowed values and nothing more. In PostgreSQL, enumerations behave similarly to the enum type of many other programming languages such as C or Java.
An enumeration is defined by adding text labels to the type. Each label represents one, and only one, value. There are a few rules to keep in mind when creating an enumeration. These are as follows:
- Labels are case-sensitive and can include spaces
- The order in which labels are added to the data type also represents the order of comparison between different labels (for example, the first label is less than the last one)
- Usually, a label cannot be longer than 63 bytes (for example, the internal NAMEDATLEN value)
- A label cannot be removed once it has been added