Re: extensible enum types - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: extensible enum types
Date
Msg-id 4C1DEC62020000250003264D@gw.wicourts.gov
Whole thread Raw
In response to extensible enum types  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: extensible enum types  (Peter Geoghegan <peter.geoghegan86@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: extensible enum types
Next
From: Tom Lane
Date:
Subject: Re: beta3 & the open items list