Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8f54beff
提交
8f54beff
authored
3月 18, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move some tests from testScript.sql to range_table.sql
上级
d840655a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
74 行增加
和
78 行删除
+74
-78
range_table.sql
h2/src/test/org/h2/test/scripts/range_table.sql
+74
-0
testScript.sql
h2/src/test/org/h2/test/scripts/testScript.sql
+0
-78
没有找到文件。
h2/src/test/org/h2/test/scripts/range_table.sql
浏览文件 @
8f54beff
...
...
@@ -3,6 +3,80 @@
-- Initial Developer: H2 Group
--
explain
select
*
from
system_range
(
1
,
2
)
where
x
=
x
+
1
and
x
=
1
;
>
PLAN
>
---------------------------------------------------------------------------------------------------------------------------------
>
SELECT
SYSTEM_RANGE
.
X
FROM
SYSTEM_RANGE
(
1
,
2
)
/* PUBLIC.RANGE_INDEX: X = 1 */
WHERE
((
X
=
1
)
AND
(
X
=
(
X
+
1
)))
AND
(
1
=
(
X
+
1
))
>
rows
:
1
explain
select
*
from
system_range
(
1
,
2
)
where
not
(
x
=
1
and
x
*
2
=
2
);
>
PLAN
>
-------------------------------------------------------------------------------------------------------
>
SELECT
SYSTEM_RANGE
.
X
FROM
SYSTEM_RANGE
(
1
,
2
)
/* PUBLIC.RANGE_INDEX */
WHERE
(
X
<>
1
)
OR
((
X
*
2
)
<>
2
)
>
rows
:
1
explain
select
*
from
system_range
(
1
,
10
)
where
(
NOT
x
>=
5
);
>
PLAN
>
------------------------------------------------------------------------------------------
>
SELECT
SYSTEM_RANGE
.
X
FROM
SYSTEM_RANGE
(
1
,
10
)
/* PUBLIC.RANGE_INDEX: X < 5 */
WHERE
X
<
5
>
rows
:
1
select
(
select
t1
.
x
from
system_range
(
1
,
1
)
t2
)
from
system_range
(
1
,
1
)
t1
;
>
SELECT
T1
.
X
FROM
SYSTEM_RANGE
(
1
,
1
)
T2
/* PUBLIC.RANGE_INDEX */
/* scanCount: 2 */
>
----------------------------------------------------------------------------------
>
1
>
rows
:
1
EXPLAIN
PLAN
FOR
SELECT
*
FROM
SYSTEM_RANGE
(
1
,
20
);
>
PLAN
>
-----------------------------------------------------------------------
>
SELECT
SYSTEM_RANGE
.
X
FROM
SYSTEM_RANGE
(
1
,
20
)
/* PUBLIC.RANGE_INDEX */
>
rows
:
1
select
sum
(
x
)
from
system_range
(
2
,
1000
)
r
where
not
exists
(
select
*
from
system_range
(
2
,
32
)
r2
where
r
.
x
>
r2
.
x
and
mod
(
r
.
x
,
r2
.
x
)
=
0
);
>
SUM
(
X
)
>
------
>
76127
>
rows
:
1
SELECT
COUNT
(
*
)
FROM
SYSTEM_RANGE
(
0
,
2111222333
);
>
COUNT
(
*
)
>
----------
>
2111222334
>
rows
:
1
select
*
from
system_range
(
2
,
100
)
r
where
not
exists
(
select
*
from
system_range
(
2
,
11
)
r2
where
r
.
x
>
r2
.
x
and
mod
(
r
.
x
,
r2
.
x
)
=
0
);
>
X
>
--
>
11
>
13
>
17
>
19
>
2
>
23
>
29
>
3
>
31
>
37
>
41
>
43
>
47
>
5
>
53
>
59
>
61
>
67
>
7
>
71
>
73
>
79
>
83
>
89
>
97
>
rows
:
25
SELECT
*
FROM
SYSTEM_RANGE
(
1
,
10
)
ORDER
BY
1
;
>
X
>
--
...
...
h2/src/test/org/h2/test/scripts/testScript.sql
浏览文件 @
8f54beff
...
...
@@ -1950,24 +1950,6 @@ create table test as select 1, space(10) from dual where 1=0 union all select x,
drop table test;
> ok
explain select * from system_range(1, 2) where x=x+1 and x=1;
> PLAN
> ---------------------------------------------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 2) /* PUBLIC.RANGE_INDEX: X = 1 */ WHERE ((X = 1) AND (X = (X + 1))) AND (1 = (X + 1))
> rows: 1
explain select * from system_range(1, 2) where not (x = 1 and x*2 = 2);
> PLAN
> -------------------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 2) /* PUBLIC.RANGE_INDEX */ WHERE (X <> 1) OR ((X * 2) <> 2)
> rows: 1
explain select * from system_range(1, 10) where (NOT x >= 5);
> PLAN
> ------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 10) /* PUBLIC.RANGE_INDEX: X < 5 */ WHERE X < 5
> rows: 1
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
> ok
...
...
@@ -3042,12 +3024,6 @@ SELECT t1.ID, (SELECT t1.id || ':' || AVG(t2.ID) FROM X t2) FROM X t1;
drop table x;
> ok
select (select t1.x from system_range(1,1) t2) from system_range(1,1) t1;
> SELECT T1.X FROM SYSTEM_RANGE(1, 1) T2 /* PUBLIC.RANGE_INDEX */ /* scanCount: 2 */
> ----------------------------------------------------------------------------------
> 1
> rows: 1
create table test(id int primary key, name varchar);
> ok
...
...
@@ -5872,12 +5848,6 @@ EXPLAIN PLAN FOR SELECT LEFT(NAME, 2) FROM TEST;
> SELECT LEFT(NAME, 2) FROM PUBLIC.TEST /* PUBLIC.TEST.tableScan */
> rows: 1
EXPLAIN PLAN FOR SELECT * FROM SYSTEM_RANGE(1, 20);
> PLAN
> -----------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 20) /* PUBLIC.RANGE_INDEX */
> rows: 1
SELECT * FROM test t1 inner join test t2 on t1.id=t2.id and t2.name is not null where t1.id=1;
> ID NAME ID NAME
> -- ----- -- -----
...
...
@@ -6358,54 +6328,6 @@ SELECT * FROM TEST;
DROP TABLE TEST;
> ok
--- range ----------------------------------------------------------------------------------------------
--import java.math.*;
--int s=0;for(int i=2;i<=1000;i++)
--s+=BigInteger.valueOf(i).isProbablePrime(10000)?i:0;s;
select sum(x) from system_range(2, 1000) r where
not exists(select * from system_range(2, 32) r2 where r.x>r2.x and mod(r.x, r2.x)=0);
> SUM(X)
> ------
> 76127
> rows: 1
SELECT COUNT(*) FROM SYSTEM_RANGE(0, 2111222333);
> COUNT(*)
> ----------
> 2111222334
> rows: 1
select * from system_range(2, 100) r where
not exists(select * from system_range(2, 11) r2 where r.x>r2.x and mod(r.x, r2.x)=0);
> X
> --
> 11
> 13
> 17
> 19
> 2
> 23
> 29
> 3
> 31
> 37
> 41
> 43
> 47
> 5
> 53
> 59
> 61
> 67
> 7
> 71
> 73
> 79
> 83
> 89
> 97
> rows: 25
--- syntax errors ----------------------------------------------------------------------------------------------
CREATE SOMETHING STRANGE;
> exception
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论