提交 4d710ddd authored 作者: Thomas Mueller's avatar Thomas Mueller

The comment of a domain (user defined data type) is now used as the default…

The comment of a domain (user defined data type) is now used as the default column comment when creating a column with this domain.
上级 682efd30
...@@ -3167,7 +3167,10 @@ public class Parser { ...@@ -3167,7 +3167,10 @@ public class Parser {
int value = getPositiveInt(); int value = getPositiveInt();
column.setSelectivity(value); column.setSelectivity(value);
} }
column.setComment(readCommentIf()); String comment = readCommentIf();
if (comment != null) {
column.setComment(comment);
}
return column; return column;
} }
...@@ -3213,6 +3216,7 @@ public class Parser { ...@@ -3213,6 +3216,7 @@ public class Parser {
long precision = -1; long precision = -1;
int displaySize = -1; int displaySize = -1;
int scale = -1; int scale = -1;
String comment = null;
Column templateColumn = null; Column templateColumn = null;
if (dataType == null) { if (dataType == null) {
UserDataType userDataType = database.findUserDataType(original); UserDataType userDataType = database.findUserDataType(original);
...@@ -3221,6 +3225,7 @@ public class Parser { ...@@ -3221,6 +3225,7 @@ public class Parser {
} }
templateColumn = userDataType.getColumn(); templateColumn = userDataType.getColumn();
dataType = DataType.getDataType(templateColumn.getType()); dataType = DataType.getDataType(templateColumn.getType());
comment = templateColumn.getComment();
original = templateColumn.getOriginalSQL(); original = templateColumn.getOriginalSQL();
precision = templateColumn.getPrecision(); precision = templateColumn.getPrecision();
displaySize = templateColumn.getDisplaySize(); displaySize = templateColumn.getDisplaySize();
...@@ -3296,6 +3301,7 @@ public class Parser { ...@@ -3296,6 +3301,7 @@ public class Parser {
column.addCheckConstraint(session, checkConstraint); column.addCheckConstraint(session, checkConstraint);
} }
} }
column.setComment(comment);
column.setOriginalSQL(original); column.setOriginalSQL(original);
return column; return column;
} }
......
...@@ -600,7 +600,7 @@ public class Column { ...@@ -600,7 +600,7 @@ public class Column {
this.comment = comment; this.comment = comment;
} }
String getComment() { public String getComment() {
return comment; return comment;
} }
......
create domain email as varchar comment 'e-mail';
create table test(e email);
select remarks from INFORMATION_SCHEMA.COLUMNS where table_name='TEST';
> e-mail;
drop table test;
drop domain email;
create table test$test(id int); create table test$test(id int);
drop table test$test; drop table test$test;
create table test$$test(id int); create table test$$test(id int);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论