Skip site navigation (1) Skip section navigation (2)

How to modify ENUM datatypes?

From: "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>
To: Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: How to modify ENUM datatypes?
Date: 2008-04-22 10:01:41
Message-ID: 480DB785.9010700@lorenso.com (view raw or flat)
Thread:
Lists: pgsql-general
All,

In the past I have used foreign keys to lookup tables for small lists of 
values that I now think ENUM could do the job of.  I was hoping that by 
using ENUM, I would avoid having to do joins in my queries, and that I'd 
be making the data more robust and faster.

I used to have a table for account_status:

   A | Active
   B | Billing Failed
   C | Closed
   D | Deactivated

   account.acct_type CHAR references account_type.acct_type CHAR

But, now I've converted that to an ENUM:

   ACTIVE
   BILLING_FAILED
   CLOSED
   DEACTIVATED

   account.acct_type ENUM account_type

The problem is that once I create a column in my account table that uses 
this 'account_type' datatype, I can't seem to change or add to it any 
more.  I want to add a new value or edit/delete an existing one.

How do you make changes to an ENUM datatype that is already in use?

-- Dante




Responses

pgsql-general by date

Next:From: Albe LaurenzDate: 2008-04-22 10:30:12
Subject: Re: Postgres Encoding conversion problem
Previous:From: wstrzalkaDate: 2008-04-22 09:41:50
Subject: plpgsql and logical expression evaluation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group