Skip site navigation (1) Skip section navigation (2)

Re: Enums patch v2

From: Tom Dunstan <pgsql(at)tomd(dot)cc>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org, Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Subject: Re: Enums patch v2
Date: 2006-12-20 02:00:48
Message-ID: 45889950.5000603@tomd.cc (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Peter Eisentraut wrote:
> An objection to enums on the ground that foreign keys can accomplish the 
> same thing could be extended to object to any data type with a finite 
> domain.

Exactly. The extreme case is the boolean type, which could easily be 
represented by a two-value enum. Or, if you were feeling masochistic, a 
FK to a separate table. Which is easier?

People regularly do stuff like having domains over finite text values, 
or having a FK to a separate (static) table, or using some sort of EAV. 
Enums are type-safe, easily ordered, relatively efficient and don't 
leave zillions of little static tables all over the place, a combination 
of attributes that none of the alternative solutions in this space present.

Cheers

Tom


In response to

pgsql-hackers by date

Next:From: Glen ParkerDate: 2006-12-20 02:16:44
Subject: Re: Autovacuum Improvements
Previous:From: Matthew O'ConnorDate: 2006-12-20 01:52:33
Subject: Re: Autovacuum Improvements

pgsql-patches by date

Next:From: ITAGAKI TakahiroDate: 2006-12-20 03:19:51
Subject: Re: [PATCHES] Load distributed checkpoint patch
Previous:From: Tom DunstanDate: 2006-12-20 01:39:58
Subject: Re: [HACKERS] Enums patch v2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group