Re: enum data type

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: enum data type
Date: 2001-10-02 16:45:39
Message-ID: B7DF4B53.3FDD%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Postgres doesn't explicitly, but you can make one yourself:

CREATE TABLE enum ( id SERIAL PRIMARY KEY, data VARCHAR(10) );

CREATE TABLE test (
field INT REFERENCES enum
);

You could have a rule or trigger for "test" that converts the textual
representation to it's numeric id on insert if you want the added
convenience.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

> From: travis <smitht(at)cache(dot)net>
> Organization: Newsfeeds.com http://www.newsfeeds.com 80,000+ UNCENSORED
> Newsgroups.
> Date: Fri, 28 Sep 2001 15:00:59 -0600
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] enum data type
>
> can somebody point me in the direction of info on how to implement an
> 'enum' data type?
>
> trav
>
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Keary Suska 2001-10-02 17:07:07 Re: Using Postgresql-7.0.1 in multiple clients
Previous Message Tom Lane 2001-10-02 15:06:03 Re: number of views supported in 7.1