Suggestion for Enum Support Functions

From: toronto programmer <torontoprogrammer(at)yahoo(dot)ca>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Suggestion for Enum Support Functions
Date: 2007-06-20 03:21:50
Message-ID: 157876.1259.qm@web58601.mail.re3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Postgres developers,

I have been working with Oracle for few years now in my work, and I tried some free databases for a project that I'm developing for my own use, I have tried H2,FireBird and postgres, and found the last to be the most stable and feature-rich, so thanks for all the good work.

I have read the 8.3 documentation, and with reference to Enum Support Functions found on http://developer.postgresql.org/pgdocs/postgres/functions-enum.html, i think it is useful to add 2 functions, enum_after(anyenum) and enum_before(anyenum), so having :

CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple');
enum_after('orange'::rainbow) will return 'yellow'
enum_after('purple'::rainbow) will return an error
enum_before('purple'::rainbow) will return 'blue'

a good to have function would be enum_size(anyenum) which would return 6 in the previous example
that will be helpful in dealing with enums

Best regards

Hashim Kubba

Get a sneak peak at messages with a handy reading pane with All new Yahoo! Mail: http://mrd.mail.yahoo.com/try_beta?.intl=ca

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-06-20 03:54:42 Re: GUC time unit spelling a bit inconsistent
Previous Message Chris Browne 2007-06-20 03:01:39 Re: PG-MQ?