enum data type vs table

From: Seb <spluque(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: enum data type vs table
Date: 2011-05-18 04:23:38
Message-ID: 87ipt8tz5h.fsf@kolob.subpolar.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Are there any guidelines for deciding whether to 1) create an enum data
type or 2) create a table with the set of values and then have foreign
keys referencing this table? Some fields in a database take a small
number of values, and I'm not sure which of these routes to take. The
enum data type seems like a clean way to handle this without creating a
constellation of tables for all these values, but if one wants to add a
new label to the enum or make changes to it at some point, then the
tables using it have to be recreated, so it's quite rigid. Have I got
this right? Thanks.

--
Seb

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gary Stainburn 2011-05-18 19:10:19 foreign keys and lots of tables
Previous Message Jasen Betts 2011-05-17 09:07:04 Re: self join