Re: How to modify ENUM datatypes?

From: Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to modify ENUM datatypes?
Date: 2008-04-23 10:38:48
Message-ID: 20080423123848.7a91184c@iridium.wars-nicht.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 22 Apr 2008 15:45:39 -0500 D. Dante Lorenso wrote:

> Andreas 'ads' Scherbaum wrote:
>
> So, the advice here is "don't use ENUM"?

Yes. You should/can use ENUM for something like 'gender':
male, female, unknown. You don't need to add other values ever (yeah, i
skipped some special cases).

But if you use ENUM for color names (as example), it's easy to imagine
that someone comes around and requests a new color to be added to the
list. Here you should use a lookup table and a foreign key instead.

It always depends on the situation. The real problem is that people
start creating the table with ENUM and "oh, nice, this makes it easy"
in mind. But usually things are not as easy as it looks on first sight,
so they later run into trouble.

Kind regards

--
Andreas 'ads' Scherbaum
German PostgreSQL User Group

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2008-04-23 10:42:10 Re: initdb in 8.3
Previous Message Simon Riggs 2008-04-23 10:04:47 Re: Rapidly decaying performance repopulating a large table