PostgreSQL: Change an ENUM type 2010-12-08

Changing an ENUM type in PostgreSQL is not an easy task. A small modification directly in the Schema does the trick:

-- As of PostreSQL 8.x:
INSERT INTO pg_enum(enumtypid,enumlabel)
(SELECT oid FROM pg_type WHERE typtype = 'e' AND typname = 'enum_typ_name'), 'neuer_wert'

On newer PostgreSQL versions, you can add a new value like this:

ALTER TYPE colors ADD VALUE 'orange' AFTER 'red';