Search Postgresql Archives

Re: How to modify ENUM datatypes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux