Re: For the ametures. (related to "Are we losing momentum?") - Mailing list pgsql-hackers

From Jon Jensen
Subject Re: For the ametures. (related to "Are we losing momentum?")
Date
Msg-id Pine.LNX.4.50.0304171732480.1617-100000@louche.swelter.net
Whole thread Raw
In response to Re: For the ametures. (related to "Are we losing momentum?")  ("Dave Page" <dpage@vale-housing.co.uk>)
List pgsql-hackers
On Thu, 17 Apr 2003, Dave Page wrote:

> > -    Data types like 'ENUM' which appeal to ametures.
> 
> Isn't that just syntactic sugar for a column with a check for specific
> values on it?

I believe it's actually different. In PostgreSQL you'd use a VARCHAR 
column with CHECK constraints, which means there are actual possibly 
lengthy strings in the database. In MySQL's ENUM, the table structure maps 
a particular string to a bit pattern, so if you have two possible values, 
'superdogfood' and 'onetwothreefourfivesixseven', your column will only 
take 1 bit + overhead. Obviously no big deal until you get a few dozen 
possibilities. This is also what allows the SET type to work -- it's a set 
of binary flags for a named list of elements. The docs are here:

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#ENUM

I don't like the fact that numbers don't really work (being used as 
indices rather than names), that case isn't tolerated, that invalid 
entries go in as empty strings, etc., so I certainly wouldn't want to see 
them emulated exactly in PostgreSQL, but I imagine that ENUM could save a 
lot of disk space in certain circumstances, and SET seems useful.

Jon



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: For the ametures. (related to "Are we losing momentum?")
Next
From: Peter Eisentraut
Date:
Subject: Re: For the ametures. (related to "Are we losing momentum?")