提交 c26dc504 authored 作者: Thomas Mueller's avatar Thomas Mueller

When adding a comment to a column that has a check constraint, the database couldn't be re-opened.

上级 b58833b3
...@@ -438,12 +438,12 @@ public class Column { ...@@ -438,12 +438,12 @@ public class Column {
if (selectivity != 0) { if (selectivity != 0) {
buff.append(" SELECTIVITY ").append(selectivity); buff.append(" SELECTIVITY ").append(selectivity);
} }
if (checkConstraint != null) {
buff.append(" CHECK ").append(checkConstraintSQL);
}
if (comment != null) { if (comment != null) {
buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment)); buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment));
} }
if (checkConstraint != null) {
buff.append(" CHECK ").append(checkConstraintSQL);
}
return buff.toString(); return buff.toString();
} }
......
...@@ -36,6 +36,7 @@ public class TestCases extends TestBase { ...@@ -36,6 +36,7 @@ public class TestCases extends TestBase {
} }
public void test() throws Exception { public void test() throws Exception {
testColumnWithConstraintAndComment();
testTruncateConstraintsDisabled(); testTruncateConstraintsDisabled();
testPreparedSubquery2(); testPreparedSubquery2();
testPreparedSubquery(); testPreparedSubquery();
...@@ -82,6 +83,20 @@ public class TestCases extends TestBase { ...@@ -82,6 +83,20 @@ public class TestCases extends TestBase {
deleteDb("cases"); deleteDb("cases");
} }
private void testColumnWithConstraintAndComment() throws SQLException {
if (config.memory) {
return;
}
deleteDb("cases");
Connection conn = getConnection("cases");
Statement stat = conn.createStatement();
stat.execute("create table test(id int check id < 500)");
stat.execute("comment on column test.id is 'comment'");
conn.close();
conn = getConnection("cases");
conn.close();
}
private void testTruncateConstraintsDisabled() throws SQLException { private void testTruncateConstraintsDisabled() throws SQLException {
deleteDb("cases"); deleteDb("cases");
Connection conn = getConnection("cases"); Connection conn = getConnection("cases");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论