---
source: https://iinventedlight.com/library/notes/postgres-enum-types.md
title: "PostgreSQL enum types"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PostgreSQL License; prose restates cited source lines"
attribution: "Summary by iinventedlight (AI-assisted). Sources: PostgreSQL Global Development Group, PostgreSQL: Documentation: 18: 8.7. Enumerated Types, PostgreSQL License; PostgreSQL Global Development Group, PostgreSQL: Documentation: 18: CREATE TYPE, PostgreSQL License."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-04
as_of: 2026-11-04
confidence: medium
untested: "No code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-ai-eng: PostgreSQL"
tags: ['postgresql', 'sql', 'data-types', 'enums']
sources:
  - id: S1
    title: "PostgreSQL: Documentation: 18: 8.7. Enumerated Types"
    publisher: PostgreSQL Global Development Group
    url: https://www.postgresql.org/docs/current/datatype-enum.html
    accessed: 2026-11-04
    license: "PostgreSQL License"
  - id: S2
    title: "PostgreSQL: Documentation: 18: CREATE TYPE"
    publisher: PostgreSQL Global Development Group
    url: https://www.postgresql.org/docs/current/sql-createtype.html
    accessed: 2026-11-04
    license: "PostgreSQL License"
---
# PostgreSQL enum types

**Answer:** An enum type is a fixed, ordered list of text labels created with `CREATE TYPE name AS ENUM (...)`. Values sort in declaration order, take four bytes on disk, and labels are case sensitive.

```sql
CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
CREATE TABLE person (name text, current_mood mood);
INSERT INTO person VALUES ('Moe', 'happy');
SELECT * FROM person WHERE current_mood > 'sad';
```

## Facts

- Labels are limited by NAMEDATALEN, 63 bytes in standard builds.
- Labels live in the `pg_enum` system catalog.

## Changing an enum

```sql
ALTER TYPE mood ADD VALUE 'ecstatic' AFTER 'happy';
ALTER TYPE mood RENAME VALUE 'ok' TO 'fine';
```

Removing a value is not supported directly.

## Claims
- id: C1
  claim: Enum labels are case sensitive.
  source: S1
  evidence: "Enum labels are case sensitive, so 'happy' is not the same as 'HAPPY'."
- id: C2
  claim: An enum value occupies four bytes on disk.
  source: S1
  evidence: "An enum value occupies four bytes on disk."
- id: C3
  claim: Enum labels are kept in the pg_enum catalog.
  source: S1
  evidence: "are kept in the system catalog pg_enum."
- id: C4
  claim: CREATE TYPE registers a new data type for the current database.
  source: S2
  evidence: "CREATE TYPE registers a new data type for use in the current database."
- id: C5
  claim: The docs create a bug_status enum.
  source: S2
  evidence: "CREATE TYPE bug_status AS ENUM ('new', 'open', 'closed');"

## Sources
- [S1] PostgreSQL: Documentation: 18: 8.7. Enumerated Types. PostgreSQL Global Development Group. https://www.postgresql.org/docs/current/datatype-enum.html . License: PostgreSQL License. Accessed 2026-11-04.
- [S2] PostgreSQL: Documentation: 18: CREATE TYPE. PostgreSQL Global Development Group. https://www.postgresql.org/docs/current/sql-createtype.html . License: PostgreSQL License. Accessed 2026-11-04.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
