best way to handle enum type - Mailing list pgsql-general

From Tom Hart
Subject best way to handle enum type
Date
Msg-id 4744BB8E.9010308@coopfed.org
Whole thread Raw
Responses Re: best way to handle enum type  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-general
Hey everybody. I have a field that, in my earlier mySQL days would have
been an enum('q','y','m','c'), and I'm wondering what's the best way to
handle this in pgsql. I've googled enough to find out that pgsql doesn't
have a built in enum type (it's of course possible that what I read was
outdated, please let me know if it was), but I've found a couple popular
workarounds, the first being

CHECK (favourite_colour IN ('red', 'blue', 'yellow', 'purple'))

as well as a suggestion to create another small table containing the
possible values and then placing

color text references color

in the create table sql. Now this field doesn't absolutely have to be an
enum, I'm sure I could work with matching the values to numbers and
making it an int. What I'm wondering is what's generally considered
'best practice' for this situation. I'd like to have a solid db more
than an enum type, what's my best move?

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: Coordinating database user accounts with active directory
Next
From: "Selena Deckelmann"
Date:
Subject: POLL: Women-sized t-shirts for PostgreSQL