Re: enums

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: ted(at)php(dot)net
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: enums
Date: 2005-10-27 21:26:13
Message-ID: 20051027212613.GP63747@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

  • Re: enums at 2005-10-27 20:54:36 from Ted Rolle

Responses

  • Re: enums at 2005-10-27 23:02:45 from Andrew Dunstan

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Murphy 2005-10-27 21:42:45 Re: [GENERAL] aix build question re: duplicate symbol warning
Previous Message Grzegorz Piotr Jaskiewicz 2005-10-27 21:15:53 _penalty gist method invoked with one key NULL