This occurred to me yesterday as I was designing a little Db.

Has anyone thought about support for a simple enumeration type creation
mechanism? I know I could do it with CREATE TYPE and input/output functions,
but that does seem like a lot of work for a smallish thing.

As it is, I settled on a char type with some constraint checking, but
couldn't help thinking how nice a simple enumeration would have been.

andrew


Sat, 14 Jun 2003 16:49:10 -0400
"Andrew Dunstan" <andrew@dunslane.net>
enumeration type?
There is no such thing as an enumeration type.  What there is is the char
type with a CHECK constraint. MySQL made up ENUMs out of whole cloth...they
should copy our way, not us theirs...

Chris

----- Original Message ----- 
From: "Andrew Dunstan" <andrew@dunslane.net>
To: "PostgreSQL Hackers Mailing List" <pgsql-hackers@postgresql.org>
Sent: Sunday, June 15, 2003 4:49 AM
Subject: [HACKERS] enumeration type?


> This occurred to me yesterday as I was designing a little Db.
>
> Has anyone thought about support for a simple enumeration type creation
> mechanism? I know I could do it with CREATE TYPE and input/output
functions,
> but that does seem like a lot of work for a smallish thing.
>
> As it is, I settled on a char type with some constraint checking, but
> couldn't help thinking how nice a simple enumeration would have been.
>
> andrew
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


Mon, 16 Jun 2003 13:53:12 +0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
Re: enumeration type?
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> MySQL made up ENUMs out of whole cloth...they
> should copy our way, not us theirs...

ENUMs do seem to have some advantages in convenience though.  And
providing them or something closely comparable would ease porting
from MySQL ... which is an important consideration in our plan for
world domination ;-)

In short I wouldn't object to having this on the TODO list.  It's just
not real high priority in my mind.

			regards, tom lane

Mon, 16 Jun 2003 09:36:00 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: enumeration type? 
Tom Lane writes:

> ENUMs do seem to have some advantages in convenience though.  And
> providing them or something closely comparable would ease porting
> from MySQL ... which is an important consideration in our plan for
> world domination ;-)

Now that domains have check constraints, I think enumerations can be
easily created without having to invent nonstandard features.  There's
also the advantage that you can create domains out of data types other
than text.

-- 
Peter Eisentraut   peter_e@gmx.net


Mon, 16 Jun 2003 20:59:48 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: enumeration type? 