Re: CHECK versus a Table for an enumeration - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: CHECK versus a Table for an enumeration
Date
Msg-id 20031223005602.GF2752@dcc.uchile.cl
Whole thread Raw
In response to CHECK versus a Table for an enumeration  (Melanie Bergeron <mbergeron_pg@globeecom.com>)
List pgsql-general
On Mon, Dec 22, 2003 at 04:37:51PM -0500, Melanie Bergeron wrote:

> I want to know what's better between these 2 solutions :
>
> CREATE TABLE user (
> ...
> user_type   text     CHECK(user_type='Root' OR user_type = 'Admin' OR
> user_type = 'Standard'));
>
> or the following :
>
> CREATE TABLE user_type(
> user_type_id     integer   PRIMARY KEY,
> user_type_desc text);

Check out the second article at
                                        
http://www.varlena.com/varlena/GeneralBits/42.php

It contains some discussion on this issue.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The West won the world not by the superiority of its ideas or values
or religion but rather by its superiority in applying organized violence.
Westerners often forget this fact, non-Westerners never do."
(Samuel P. Huntington)

pgsql-general by date:

Previous
From: Paul Thomas
Date:
Subject: Re: CHECK versus a Table for an enumeration
Next
From: Adrian Klaver
Date:
Subject: Re: windows distribution