From: | "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
---|---|
To: | <jd(at)commandprompt(dot)com>,<peter(dot)geoghegan86(at)gmail(dot)com> |
Cc: | <simon(at)2ndquadrant(dot)com>,<andrew(at)dunslane(dot)net>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: extensible enum types |
Date: | 2010-06-20 15:24:34 |
Message-ID: | 4C1DEC62020000250003264D@gw.wicourts.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Peter Geoghegan wrote:
> How many lookup tables have you seen in the wild with a natural
> key?
Me? Personally? A few hundred.
> People sometimes represent things like US states as enums. This is
> probably a mistake, because you cannot control or predict if
> there'll be a new US state, unlikely though that me be.
More importantly, you're likely to need to associate properties with
the state. Sales tax info, maybe a sales manager, etc. A state
table can be a handy place to store things like that.
> I don't like the idea of having values in a table that aren't so
> much data as an integral part of your application/database.
Yep, exactly why natural keys should be used when possible.
-Kevin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-06-20 15:36:56 | Re: beta3 & the open items list |
Previous Message | Peter Geoghegan | 2010-06-20 15:02:37 | Re: extensible enum types |