Re: Enumerated data type

From: Tom Cook <tcook(at)lisa(dot)com(dot)au>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Enumerated data type
Date: 2000-05-02 23:31:31
Message-ID: Pine.LNX.4.10.10005030900080.18873-100000@frog.adl.ardec.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2 May 2000, Peter Eisentraut wrote:

> Anand Raman writes:
>
> > Is there anything equivalent to the enumerated data types in
> > postgresql..
>
> You might find that strings with check constraints will do the job, e.g.
>
> create table my_tbl (
> ...
> color text check color in ('blue', 'green', 'white'),
> ...
> );
>

For anything much more than this, I'd just create a table with all the
possible values in it, each with a unique identifier, and then use the
identifier in my_tbl. Then you can control the possible values more
easily.

--
Tom Cook - Software Engineer

"Never criticize a man until you've walked a mile in his shoes; that way,
when you criticize him, you're a mile away and have his shoes."
- A froggy bloke on a news group.

LISAcorp - www.lisa.com.au

--------------------------------------------------
38 Greenhill Rd. Level 3, 228 Pitt Street
Wayville, SA, 5034 Sydney, NSW, 2000

Phone: +61 8 8272 1555 Phone: +61 2 9283 0877
Fax: +61 8 8271 1199 Fax: +61 2 9283 0866
--------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert B. Easter 2000-05-03 01:27:26 Re: OID output problems
Previous Message Tom Cook 2000-05-02 23:24:59 Re: postgresql7.0 jdbc driver