Re: ENUM like data type

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: ENUM like data type
Date: 2005-06-29 13:28:49
Message-ID: 1120051729.39304.113.camel@home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 2005-06-29 at 10:21 -0300, Martín Marqués wrote:
> El Mié 29 Jun 2005 09:40, KÖPFERL Robert escribió:
> >
> > |
> > |I personally think that the ENUM data type is for databases
> > |that are not well
> > |designed. So, if you see the need for ENUM, that means you
> > |need to re-think
> > |your data design.
> > |
> >
> > I disagree. In several relations (views of the world) one needs to have a
> > hand full of well defined values while
> > integers or bools are not appropriate and strings are too free form.
> > For example male female or true and false. Whilst the second has a well
> > known type, other things like a telephone number type don't have such type.
> > So a new one should be created instead of (varchar/ xy between 4 and 8). One
> > might argue that new 1:n relations with integrity shall be established but
> > this is in my eyes overkill for a constant number of values.
> > Also think of schema export without data. These values are part of the
> > schema data but not the schema itself which in this sense is wrong
>
> Please, most of this can be done with CHECK(...).

Indeed. A CHECK constraint on a DOMAIN is an ENUM plus some.

--

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Russell Simpkins 2005-06-29 14:22:07 Re: ORDER records based on parameters in IN clause
Previous Message Bruno Wolff III 2005-06-29 13:23:48 Re: cross-table reference