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

Поиск
Список
Период
Сортировка
От Jon Jensen
Тема Re: For the ametures. (related to "Are we losing momentum?")
Дата
Msg-id Pine.LNX.4.50.0304171732480.1617-100000@louche.swelter.net
обсуждение исходный текст
Ответ на Re: For the ametures. (related to "Are we losing momentum?")  ("Dave Page" <dpage@vale-housing.co.uk>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: For the ametures. (related to "Are we losing momentum?")
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: For the ametures. (related to "Are we losing momentum?")