RefLib

Reference library for AI

Back

postgresql_16:3.5.7.4 Implementation Details

PostgreSQL 16 > The SQL Language > Data Types > Enumerated Types > Implementation Details

Enum labels are case sensitive, so 'happy' is not the same as 'HAPPY'. White space in the labels is significant too.

Although enum types are primarily intended for static sets of values, there is support for adding new values to an existing enum type, and for renaming values (see (see postgresql_16:7.1.40)). Existing values cannot be removed from an enum type, nor can the sort ordering of such values be changed, short of dropping and re-creating the enum type.

An enum value occupies four bytes on disk. The length of an enum value's textual label is limited by the NAMEDATALEN setting compiled into PostgreSQL; in standard builds this means at most 63 bytes.

The translations from internal enum values to textual labels are kept in the system catalog pg_enum (see postgresql_16:8.2.20). Querying this catalog directly can be useful.

Back