Re: replacing mysql enum - Mailing list pgsql-sql

From Josh Berkus
Subject Re: replacing mysql enum
Date
Msg-id 200412111016.25046.josh@agliodbs.com
Whole thread Raw
In response to replacing mysql enum  (Kenneth Gonsalves <lawgon@thenilgiris.com>)
List 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 TEXTCHECK 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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: replacing mysql enum
Next
From: Bruno Wolff III
Date:
Subject: Re: filtering