Is there an equivalent to MySQL 'ENUM' column type in H2?

2,719 views
Skip to first unread message

jay019

unread,
Jan 8, 2008, 5:19:07 AM1/8/08
to H2 Database
Hi all,

Just wondering if there is an equivalent column type to the 'ENUM'
column type in MySQL?
In MySQL I have a column like...
`status` enum('Current','Lapsed','Unknown') NOT NULL default 'Current'
and I can't work out how to do something similar in H2.

It's probably something simple that I am overlooking.

Thanks in advance.

Jay

Thomas Mueller

unread,
Jan 9, 2008, 3:48:54 PM1/9/08
to h2-da...@googlegroups.com
Hi,

I have added a feature request
(http://groups.google.com/group/h2-database/web/roadmap, Support ENUM
data type), but it will take a while until this is implemented.

A workaround is using this construct:

create table test(id int primary key, status varchar not null default
'Current' check status in ('Current', 'Lapsed', 'Unknown'));
insert into test values(1, default);

Or using a user defined data type (domain):

create domain status as varchar not null default 'Current' check value
in ('Current', 'Lapsed', 'Unknown');
create table test(id int primary key, status status);

Regards,
Thomas

Naveen Kumar

unread,
Jun 5, 2015, 10:42:06 AM6/5/15
to h2-da...@googlegroups.com
Hi,

This feature is still not available after 7 years. Its still in roadmap for 1.4.x.

When is the 1.4.x release with ENUM supported?

Thomas Mueller

unread,
Jun 5, 2015, 12:08:41 PM6/5/15
to h2-da...@googlegroups.com
Hi,

The items listed under priority 1 and 2 are not for version 1.4.x. They are for later versions.

If you need support for "enum", then I suggest to implement it yourself, and provide a patch.

Regards,
Thomas


--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages