Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
489f7c63
提交
489f7c63
authored
9月 10, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Comparison with "x = all(select ...)" or similar returned the wrong result for some cases.
上级
8f803a37
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
72 行增加
和
21 行删除
+72
-21
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
ConditionInSelect.java
h2/src/main/org/h2/expression/ConditionInSelect.java
+8
-20
test-1.3.txt
h2/src/test/org/h2/test/test-1.3.txt
+61
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
489f7c63
...
...
@@ -18,7 +18,9 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Issue 335: Could not run DROP ALL OBJECTS DELETE FILES on older databases with CLOB or BLOB data.
<ul><li>
Comparison with "x = all(select ...)" or similar returned the wrong result for some cases
(for example if the subquery returned no rows, or multiple rows with the same value, or null, or if x was null).
</li><li>
Issue 335: Could not run DROP ALL OBJECTS DELETE FILES on older databases with CLOB or BLOB data.
The problem was that the metadata table was not locked in some cases, so that
a rollback could result in a corrupt database in a database if the lob storage was upgraded.
</li><li>
Source code switching using //## has been simplified.
...
...
h2/src/main/org/h2/expression/ConditionInSelect.java
浏览文件 @
489f7c63
...
...
@@ -45,21 +45,17 @@ public class ConditionInSelect extends Condition {
LocalResult
rows
=
query
.
query
(
0
);
session
.
addTemporaryResult
(
rows
);
Value
l
=
left
.
getValue
(
session
);
if
(
rows
.
getRowCount
()
==
0
)
{
return
ValueBoolean
.
get
(
all
);
}
else
if
(
l
==
ValueNull
.
INSTANCE
)
{
return
l
;
}
if
(!
session
.
getDatabase
().
getSettings
().
optimizeInSelect
)
{
return
getValueSlow
(
rows
,
l
);
}
if
(
compareType
!=
Comparison
.
EQUAL
&&
compareType
!=
Comparison
.
EQUAL_NULL_SAFE
)
{
if
(
all
||
(
compareType
!=
Comparison
.
EQUAL
&&
compareType
!=
Comparison
.
EQUAL_NULL_SAFE
)
)
{
return
getValueSlow
(
rows
,
l
);
}
if
(
rows
.
getRowCount
()
==
0
)
{
return
ValueBoolean
.
get
(
false
);
}
if
(
l
==
ValueNull
.
INSTANCE
)
{
return
l
;
}
if
(
all
&&
rows
.
getRowCount
()
>
1
)
{
return
ValueBoolean
.
get
(
false
);
}
int
dataType
=
rows
.
getColumnType
(
0
);
if
(
dataType
==
Value
.
NULL
)
{
return
ValueBoolean
.
get
(
false
);
...
...
@@ -75,16 +71,11 @@ public class ConditionInSelect extends Condition {
}
private
Value
getValueSlow
(
LocalResult
rows
,
Value
l
)
{
// this only returns the correct result if the result has at least one
// row, and if l is not null
boolean
hasNull
=
false
;
boolean
result
=
all
;
boolean
hasRow
=
false
;
while
(
rows
.
next
())
{
if
(!
hasRow
)
{
if
(
l
==
ValueNull
.
INSTANCE
)
{
return
l
;
}
hasRow
=
true
;
}
boolean
value
;
Value
r
=
rows
.
currentRow
()[
0
];
if
(
r
==
ValueNull
.
INSTANCE
)
{
...
...
@@ -101,9 +92,6 @@ public class ConditionInSelect extends Condition {
break
;
}
}
if
(!
hasRow
)
{
return
ValueBoolean
.
get
(
false
);
}
if
(!
result
&&
hasNull
)
{
return
ValueNull
.
INSTANCE
;
}
...
...
h2/src/test/org/h2/test/test-1.3.txt
浏览文件 @
489f7c63
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(id int) as select 1;
> ok
select * from test where id >= all(select id from test where 1=0);
> ID
> --
> 1
> rows: 1
select * from test where id = all(select id from test where 1=0);
> ID
> --
> 1
> rows: 1
select * from test where id = all(select id from test union all select id from test);
> ID
> --
> 1
> rows: 1
select * from test where null >= all(select id from test where 1=0);
> ID
> --
> 1
> rows: 1
select * from test where null = all(select id from test where 1=0);
> ID
> --
> 1
> rows: 1
select * from test where null = all(select id from test union all select id from test);
> ID
> --
> rows: 0
select * from test where id >= all(select cast(null as int) from test);
> ID
> --
> rows: 0
select * from test where id = all(select null from test union all select id from test);
> ID
> --
> rows: 0
select * from test where null >= all(select cast(null as int) from test);
> ID
> --
> rows: 0
select * from test where null = all(select null from test union all select id from test);
> ID
> --
> rows: 0
drop table test;
> ok
select x from dual order by y.x;
> exception
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论