Re: How to modify ENUM datatypes?

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>
Cc: Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to modify ENUM datatypes?
Date: 2008-04-22 21:10:01
Message-ID: 65937bea0804221410w14f7c9a1g38aa521b54865f04@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Apr 22, 2008 at 3:31 PM, D. Dante Lorenso <dante(at)lorenso(dot)com> wrote:

> 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?
>

I agree with others that ENUMs stop looking pretty when you need to modify
them...

Here's a thread from recent past where this exact problem was discussed...
maybe it'll interest you...

http://archives.postgresql.org/pgsql-general/2007-12/msg01363.php

Best regards,
--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB http://www.enterprisedb.com

Mail sent from my BlackLaptop device

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-04-22 21:14:14 Re: How to modify ENUM datatypes?
Previous Message Scott Marlowe 2008-04-22 21:04:00 Re: Rapidly decaying performance repopulating a large table