pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Cc: Kenneth Gonsalves <lawgon@thenilgiris.com>
Subject: Re: replacing mysql enum
Date: Sat, 11 Dec 2004 10:16:25 -0800
Message-ID: <200412111016.25046.josh@agliodbs.com> (raw)
In-Reply-To: <04121110305520.21547@thenilgiris.com>
References: <04121110305520.21547@thenilgiris.com>

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



view thread (9+ messages)

Message-ID: <200412111016.25046.josh@agliodbs.com>
Permalink:  ../200412111016.25046.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200412111016.25046.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, lawgon@thenilgiris.com
  Subject: Re: replacing mysql enum
  In-Reply-To: <200412111016.25046.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox