Skip to content

Instantly share code, notes, and snippets.

@moraisaugusto
Created August 13, 2020 15:57
Show Gist options
  • Save moraisaugusto/5b0a8f3263c00debe691fb903ecd44a0 to your computer and use it in GitHub Desktop.
Save moraisaugusto/5b0a8f3263c00debe691fb903ecd44a0 to your computer and use it in GitHub Desktop.
Postgresql - ENUM values
-- Create enumetation
CREATE TYPE currency AS ENUM ('USD', 'BRL', 'USD');
-- Add value
ALTER TYPE currency ADD VALUE 'GBP';
-- Remove value
DELETE FROM pg_enum
WHERE enumlabel = 'GBP'
AND enumtypid = ( SELECT oid FROM pg_type WHERE typname = 'currency')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment