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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: Sat, 11 Dec 2004 10:16:25 -0800
  • Message-id: <200412111016.25046.josh@agliodbs.com> <text/plain>

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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group