Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

Next:From: Bruno Wolff IIIDate: 2004-12-11 19:01:05
Subject: Re: filtering
Previous:From: Tom LaneDate: 2004-12-11 17:56:50
Subject: Re: replacing mysql enum

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group