Re: For the ametures. (related to "Are we losing momentum?")

From: Jon Jensen <jon(at)endpoint(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: For the ametures. (related to "Are we losing momentum?")
Date: 2003-04-17 17:38:02
Message-ID: Pine.LNX.4.50.0304171732480.1617-100000@louche.swelter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2003-04-17 17:41:35 Re: For the ametures. (related to "Are we losing momentum?")
Previous Message Bruce Momjian 2003-04-17 16:40:42 Re: For the ametures. (related to "Are we losing momentum?")