type

ENUM

PostgreSQL enums are named types with an explicitly declared label order. Comparing different enum types requires explicit conversion. Example target: PostgreSQL 17. Run in a disposable database; examples need no existing tables.

Formal Syntax & Structure

sql syntaxsql
CREATE TYPE name AS ENUM (labels)

Working Example

Example Snippetsql
CREATE TYPE lab_status AS ENUM ('new','done'); SELECT CAST('new' AS lab_status) < CAST('done' AS lab_status);
SQL Reference