Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
dfe2078c
提交
dfe2078c
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delay creation of index conditions for ON conditions to avoid NPE
上级
6801c1e5
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
43 行增加
和
2 行删除
+43
-2
changelog.html
h2/src/docsrc/html/changelog.html
+4
-0
Select.java
h2/src/main/org/h2/command/dml/Select.java
+1
-0
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+21
-2
joins.sql
h2/src/test/org/h2/test/scripts/joins.sql
+17
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
dfe2078c
...
...
@@ -21,6 +21,10 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
Issue #1762: NullPointerException in Parser. Introduced in 1.4.198
</li>
<li>
PR #1768: Add more context-sensitive keywords
</li>
<li>
Issue #1758: sequence restart issue with 1.4.198
</li>
<li>
Issue #1759: SELECT
…
FOR UPDATE returns old data in 1.4.198
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
dfe2078c
...
...
@@ -1382,6 +1382,7 @@ public class Select extends Query {
private
double
preparePlan
(
boolean
parse
)
{
TableFilter
[]
topArray
=
topFilters
.
toArray
(
new
TableFilter
[
0
]);
for
(
TableFilter
t
:
topArray
)
{
t
.
createIndexConditions
();
t
.
setFullCondition
(
condition
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
dfe2078c
...
...
@@ -93,6 +93,11 @@ public class TableFilter implements ColumnResolver {
*/
private
Expression
filterCondition
;
/**
* Initial ON condition.
*/
private
Expression
onCondition
;
/**
* The complete join condition.
*/
...
...
@@ -709,18 +714,32 @@ public class TableFilter implements ColumnResolver {
* @param on the condition
*/
public
void
mapAndAddFilter
(
Expression
on
)
{
this
.
onCondition
=
on
;
on
.
mapColumns
(
this
,
0
,
Expression
.
MAP_INITIAL
);
addFilterCondition
(
on
,
true
);
on
.
createIndexConditions
(
session
,
this
);
if
(
nestedJoin
!=
null
)
{
on
.
mapColumns
(
nestedJoin
,
0
,
Expression
.
MAP_INITIAL
);
on
.
createIndexConditions
(
session
,
nestedJoin
);
}
if
(
join
!=
null
)
{
join
.
mapAndAddFilter
(
on
);
}
}
public
void
createIndexConditions
()
{
if
(
onCondition
!=
null
)
{
onCondition
.
createIndexConditions
(
session
,
this
);
if
(
nestedJoin
!=
null
)
{
onCondition
.
createIndexConditions
(
session
,
nestedJoin
);
}
}
if
(
join
!=
null
)
{
join
.
createIndexConditions
();
}
if
(
nestedJoin
!=
null
)
{
nestedJoin
.
createIndexConditions
();
}
}
public
TableFilter
getJoin
()
{
return
join
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/scripts/joins.sql
浏览文件 @
dfe2078c
...
...
@@ -785,3 +785,20 @@ SELECT T1.X1, T2.X2, T3.X3, T4.X4, T5.X5 FROM (
>
-- -- -- -- --
>
1
1
1
1
1
>
rows
:
1
CREATE
TABLE
A
(
X
INT
);
>
ok
CREATE
TABLE
B
(
Y
INT
);
>
ok
CREATE
TABLE
C
(
Z
INT
);
>
ok
SELECT
A
.
X
FROM
A
JOIN
B
ON
A
.
X
=
B
.
Y
AND
B
.
Y
>=
COALESCE
((
SELECT
Z
FROM
C
FETCH
FIRST
ROW
ONLY
),
0
);
>
X
>
-
>
rows
:
0
DROP
TABLE
A
,
B
,
C
;
>
ok
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论