Re: ENUM like data type - Mailing list pgsql-sql

From Tom Lane
Subject Re: ENUM like data type
Date
Msg-id 29905.1120085759@sss.pgh.pa.us
Whole thread Raw
In response to Re: ENUM like data type  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: ENUM like data type
List pgsql-sql
Peter Eisentraut <peter_e@gmx.net> writes:
> Rod Taylor wrote:
>> Indeed. A CHECK constraint on a DOMAIN is an ENUM plus some.

> Not really.  A domain doesn't create a new type.  If you base your enum 
> domains on the text type, as would usually be the case, then nothing 
> stops you from using, say, text concatenation operators and the like.  
> I suppose in practice this won't matter too much, but it can't be 
> called a clean design.  What you'd really need is a way to create a 
> distinct type.  SQL has a feature for that, but PostgreSQL hasn't 
> implemented it.

It's not that hard to make your own type using the builtin textin and
textout functions, and then add just the functions you wish to provide.
        regards, tom lane


pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: ENUM like data type
Next
From: "Fred Cunningham"
Date:
Subject: Error saving image to PostgresSQL 8.x database