Skip site navigation (1) Skip section navigation (2)

Re: enums

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: enums
Date: 2005-10-27 20:46:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
This is cool; it's something people can use today if nothing else.
Long-term, is it practical to have the enums compiled in? ISTM that's
not very workable, but I'm completely guessing. The other issue is that
this version makes it very difficult to change what's in the enum (not
that that's at all easy with MySQL...)

On Thu, Oct 27, 2005 at 03:47:53PM -0400, Andrew Dunstan wrote:
> If people would like to play, I have created a little kit to help in 
> creating first class enum types in a few seconds. It works something 
> like this:
>    make TYPENAME=rainbow ENUMS=' "red", "orange", "yellow", "green", 
> "blue", "indigo", "violet" '
>    make TYPENAME=rainbow install
>    psql -f /path/to/contrib/rainbow-install.sql yourdb
> and you are done. Now you can do:
>    create table foo( r rainbow);
>    insert into foo values('red');
>    select 'red'::rainbow < 'green'::rainbow; <-- yields true
>    select rainbow_order('yellow');  <-- yields 2
> The kit is at
> Needs 8.0 or later, since it use PGXS.
> Maximum number of values is 32767 - but if you use that many you're 
> insane anyway :-)
> I did this as part of thinking about how we might do enums properly. AS 
> Chris KL recently noted - it is very often asked for. So this is not the 
> end of the road, just a tiny step at the beginning.
> cheers
> andrew
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>       choose an index scan if your joining column's datatypes do not
>       match

Jim C. Nasby, Sr. Engineering Consultant      jnasby(at)pervasive(dot)com
Pervasive Software    work: 512-231-6117
vcard:       cell: 512-569-9461

In response to

  • enums at 2005-10-27 19:47:53 from Andrew Dunstan


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

pgsql-hackers by date

Next:From: Ted RolleDate: 2005-10-27 20:54:36
Subject: Re: enums
Previous:From: Tom LaneDate: 2005-10-27 20:15:23
Subject: Re: ERROR: invalid memory alloc request size <a_big_number_here>

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group