Re: CHECK versus a Table for an enumeration

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Melanie Bergeron <mbergeron_pg(at)globeecom(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CHECK versus a Table for an enumeration
Date: 2003-12-23 00:56:02
Message-ID: 20031223005602.GF2752@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2003-12-23 02:47:45 Re: windows distribution
Previous Message Paul Thomas 2003-12-23 00:27:59 Re: CHECK versus a Table for an enumeration