[prev] 38 [next]

Exercise 6: Enumerated Types

PostgreSQL allows you to define enumerated types, e.g.

create type Mood as enum ('sad', 'happy');

Creates a type with two ordered values 'sad' < 'happy'

What is created in the catalog for the above definition?

Hint:

pg_type(oid, typname, typelen, typetype, ...)
pg_enum(oid, enumtypid, enumlabel)