Unverified 提交 908705e8 authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1402 from h2database/dup-cond

Duplicate conditions in column check constraint
......@@ -691,7 +691,9 @@ public class Column {
if (expr == null) {
return;
}
resolver = new SingleColumnResolver(this);
if (resolver == null) {
resolver = new SingleColumnResolver(this);
}
synchronized (this) {
String oldName = name;
if (name == null) {
......@@ -708,7 +710,7 @@ public class Column {
}
if (checkConstraint == null) {
checkConstraint = expr;
} else {
} else if (!expr.getSQL().equals(checkConstraintSQL)) {
checkConstraint = new ConditionAndOr(ConditionAndOr.AND, checkConstraint, expr);
}
checkConstraintSQL = getCheckConstraintSQL(session, name);
......
......@@ -206,7 +206,11 @@ public class TestScript extends TestDb {
stat = conn.createStatement();
out = new PrintStream(new FileOutputStream(outFile));
errors = new StringBuilder();
testFile(BASE_DIR + scriptFileName, !scriptFileName.equals("functions/system/set.sql"));
testFile(BASE_DIR + scriptFileName,
!scriptFileName.equals("functions/numeric/rand.sql") &&
!scriptFileName.equals("functions/system/set.sql") &&
!scriptFileName.equals("ddl/createAlias.sql") &&
!scriptFileName.equals("ddl/dropSchema.sql"));
conn.close();
out.close();
if (errors.length() > 0) {
......
......@@ -2522,6 +2522,7 @@ insert into address(id, name, name2) values(1, 'test@abc', 'test@gmail.com');
insert into address(id, name, name2) values(2, 'test@abc', 'test@acme');
> exception CHECK_CONSTRAINT_VIOLATED_1
@reconnect
insert into address(id, name, name2) values(3, 'test_abc', 'test@gmail');
> exception CHECK_CONSTRAINT_VIOLATED_1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论