Re: replacing mysql enum

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: Kenneth Gonsalves <lawgon(at)thenilgiris(dot)com>
Subject: Re: replacing mysql enum
Date: 2004-12-11 18:16:25
Message-ID: 200412111016.25046.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Kenneth,

> i translated this as:
>
> field varchar(2) check (field in (null,'a','b','c')),

While this isn't the question you asked, might I encourage you to use DOMAINs
instead? I.e.:

CREATE DOMAIN abc_col AS TEXT
CHECK VALUE IN ( 'a', 'b', 'c' );

Then you declare the table as:

table (
field abc_col,
);

I find that DOMAINs give vastly enhanced managability compared to table
constraints.

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2004-12-11 19:01:05 Re: filtering
Previous Message Tom Lane 2004-12-11 17:56:50 Re: replacing mysql enum