Re: enums

Поиск
Список
Период
Сортировка
От Jim C. Nasby
Тема Re: enums
Дата
Msg-id 20051027212613.GP63747@pervasive.com
обсуждение исходный текст
Ответ на Re: enums  (Ted Rolle <ted.rolle@gmail.com>)
Ответы Re: enums  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
On Thu, Oct 27, 2005 at 04:54:36PM -0400, Ted Rolle wrote:
> This little snippet is great! The only problem I see is that the enums must
> be consistent across all modules.
> 
> What about loading a variable with a "default" value? Then it could be
> adjusted to 'play'.

Huh? Sorry, but you completely lost me here...

On another note, I noticed that the comparison operators seem to be
comparing the underlying numeric value used to store the enum, which is
wrong IMO. Consider:

ENUM color '"red","blue","green"'
CREATE TABLE t (c color);
INSERT INTO t VALUES('blue');
INSERT INTO t VALUES('green');
INSERT INTO t VALUES('red');
SELECT c FROM t ORDER BY c;
red
blue
green

That seems counter-intuitive. It's also exposing an implimentation
detail (that the enum is stored internally as a number).
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Grzegorz Piotr Jaskiewicz
Дата:
Сообщение: _penalty gist method invoked with one key NULL
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: ERROR: invalid memory alloc request size