Re: enums - Mailing list pgsql-hackers

From Jim C. Nasby
Subject Re: enums
Date
Msg-id 20051027212613.GP63747@pervasive.com
Whole thread Raw
In response to Re: enums  (Ted Rolle <ted.rolle@gmail.com>)
Responses Re: enums
List 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 by date:

Previous
From: Grzegorz Piotr Jaskiewicz
Date:
Subject: _penalty gist method invoked with one key NULL
Next
From: Alvaro Herrera
Date:
Subject: Re: ERROR: invalid memory alloc request size