提交 cb1a382d authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #487 from inikolaev/486-enum-user-data-type

#486: Support enum as user data type
......@@ -4145,6 +4145,7 @@ public class Parser {
precision = templateColumn.getPrecision();
displaySize = templateColumn.getDisplaySize();
scale = templateColumn.getScale();
enumerators = templateColumn.getEnumerators();
} else {
dataType = DataType.getTypeByName(original);
if (dataType == null) {
......
......@@ -10661,3 +10661,26 @@ alter table card alter column suit enum('hearts', 'clubs', 'spades', 'diamonds',
drop table card;
> ok
--- ENUM as custom user data type
create type CARD_SUIT as enum('hearts', 'clubs', 'spades', 'diamonds');
> ok
create table card (rank int, suit CARD_SUIT);
> ok
insert into card (rank, suit) values (0, 'clubs'), (3, 'hearts');
> update count: 2
select * from card;
> RANK SUIT
> ---- ------
> 0 clubs
> 3 hearts
drop table card;
> ok
drop type CARD_SUIT;
> ok
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论