Published on

How to Add Value to Existing Enum in Postgres

Authors
  • avatar
    Name
    TekLoon
    Twitter

Problem

We have an existing enum in Postgres and we want to add a new value to it. The existing enum looks like this:

CREATE TYPE gift_card_status_enum AS ENUM ('locked', 'unlocked');

The enum have two values locked and unlocked. We want to add a new value editing to it.

ALTER TYPE to Add New Value to Existing Enum

We could easily add a new value to the existing enum using ALTER TYPE command. Here is how we can do it:

ALTER TYPE gift_card_status_enum ADD VALUE 'editing';