Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5f07d835
Unverified
提交
5f07d835
authored
4月 21, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
4月 21, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1085 from katzyn/tests
Add tests for simple one-column index sorting
上级
6641518a
d90eeac6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
307 行增加
和
32 行删除
+307
-32
TestScript.java
h2/src/test/org/h2/test/scripts/TestScript.java
+1
-0
indexes.sql
h2/src/test/org/h2/test/scripts/indexes.sql
+306
-0
testScript.sql
h2/src/test/org/h2/test/scripts/testScript.sql
+0
-32
没有找到文件。
h2/src/test/org/h2/test/scripts/TestScript.java
浏览文件 @
5f07d835
...
...
@@ -87,6 +87,7 @@ public class TestScript extends TestBase {
testScript
(
"testScript.sql"
);
testScript
(
"derived-column-names.sql"
);
testScript
(
"indexes.sql"
);
testScript
(
"information_schema.sql"
);
testScript
(
"joins.sql"
);
testScript
(
"range_table.sql"
);
...
...
h2/src/test/org/h2/test/scripts/indexes.sql
0 → 100644
浏览文件 @
5f07d835
-- Copyright 2004-2018 H2 Group. Multiple-Licensed under the MPL 2.0,
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
-- Test all possible order modes
CREATE
TABLE
TEST
(
A
INT
);
>
ok
INSERT
INTO
TEST
VALUES
(
NULL
),
(
0
),
(
1
);
>
update
count
:
3
-- default
SELECT
A
FROM
TEST
ORDER
BY
A
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
);
>
ok
SELECT
A
FROM
TEST
ORDER
BY
A
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- ASC
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
ASC
);
>
ok
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- ASC NULLS FIRST
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
FIRST
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
ASC
NULLS
FIRST
);
>
ok
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
FIRST
;
>
A
>
----
>
null
>
0
>
1
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
NULLS
FIRST
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- ASC NULLS LAST
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
LAST
;
>
A
>
----
>
0
>
1
>
null
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
ASC
NULLS
LAST
);
>
ok
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
LAST
;
>
A
>
----
>
0
>
1
>
null
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
NULLS
LAST
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- DESC
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>
A
>
----
>
1
>
0
>
null
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
DESC
);
>
ok
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>
A
>
----
>
1
>
0
>
null
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
DESC
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- DESC NULLS FIRST
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>
A
>
----
>
null
>
1
>
0
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
DESC
NULLS
FIRST
);
>
ok
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>
A
>
----
>
null
>
1
>
0
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
DESC
NULLS
FIRST
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- DESC NULLS LAST
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>
A
>
----
>
1
>
0
>
null
>
rows
(
ordered
):
3
CREATE
INDEX
A_IDX
ON
TEST
(
A
DESC
NULLS
LAST
);
>
ok
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>
A
>
----
>
1
>
0
>
null
>
rows
(
ordered
):
3
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX */
ORDER
BY
1
DESC
NULLS
LAST
/* index sorted */
DROP
INDEX
A_IDX
;
>
ok
-- Index selection
CREATE
INDEX
A_IDX_ASC
ON
TEST
(
A
ASC
);
>
ok
CREATE
INDEX
A_IDX_ASC_NL
ON
TEST
(
A
ASC
NULLS
LAST
);
>
ok
CREATE
INDEX
A_IDX_DESC
ON
TEST
(
A
DESC
);
>
ok
CREATE
INDEX
A_IDX_DESC_NF
ON
TEST
(
A
DESC
NULLS
FIRST
);
>
ok
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC */
ORDER
BY
1
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC */
ORDER
BY
1
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC */
ORDER
BY
1
NULLS
FIRST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NL */
ORDER
BY
1
NULLS
LAST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC */
ORDER
BY
1
DESC
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC_NF */
ORDER
BY
1
DESC
NULLS
FIRST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC */
ORDER
BY
1
DESC
NULLS
LAST
/* index sorted */
DROP
INDEX
A_IDX_ASC
;
>
ok
DROP
INDEX
A_IDX_DESC
;
>
ok
CREATE
INDEX
A_IDX_ASC_NF
ON
TEST
(
A
ASC
NULLS
FIRST
);
>
ok
CREATE
INDEX
A_IDX_DESC_NL
ON
TEST
(
A
DESC
NULLS
LAST
);
>
ok
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NF */
ORDER
BY
1
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
ASC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NF */
ORDER
BY
1
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NF */
ORDER
BY
1
NULLS
FIRST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_ASC_NL */
ORDER
BY
1
NULLS
LAST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC_NL */
ORDER
BY
1
DESC
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
FIRST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC_NF */
ORDER
BY
1
DESC
NULLS
FIRST
/* index sorted */
EXPLAIN
SELECT
A
FROM
TEST
ORDER
BY
A
DESC
NULLS
LAST
;
>>
SELECT
A
FROM
PUBLIC
.
TEST
/* PUBLIC.A_IDX_DESC_NL */
ORDER
BY
1
DESC
NULLS
LAST
/* index sorted */
DROP
TABLE
TEST
;
>
ok
-- Other tests
create
table
test
(
a
int
,
b
int
);
>
ok
insert
into
test
values
(
1
,
1
);
>
update
count
:
1
create
index
on
test
(
a
,
b
desc
);
>
ok
select
*
from
test
where
a
=
1
;
>
A
B
>
-
-
>
1
1
>
rows
:
1
drop
table
test
;
>
ok
create
table
test
(
x
int
);
>
ok
create
hash
index
on
test
(
x
);
>
ok
select
1
from
test
group
by
x
;
>
1
>
-
>
rows
:
0
drop
table
test
;
>
ok
h2/src/test/org/h2/test/scripts/testScript.sql
浏览文件 @
5f07d835
...
...
@@ -90,24 +90,6 @@ AND studentID = 2;
drop
table
results
;
>
ok
create
table
test
(
a
int
,
b
int
);
>
ok
insert
into
test
values
(
1
,
1
);
>
update
count
:
1
create
index
on
test
(
a
,
b
desc
);
>
ok
select
*
from
test
where
a
=
1
;
>
A
B
>
-
-
>
1
1
>
rows
:
1
drop
table
test
;
>
ok
create
table
test
(
id
int
,
name
varchar
)
as
select
1
,
'a'
;
>
ok
...
...
@@ -132,20 +114,6 @@ select case seq.nextval when 2 then 'two' when 3 then 'three' when 1 then 'one'
drop
sequence
seq
;
>
ok
create
table
test
(
x
int
);
>
ok
create
hash
index
on
test
(
x
);
>
ok
select
1
from
test
group
by
x
;
>
1
>
-
>
rows
:
0
drop
table
test
;
>
ok
select
*
from
dual
where
x
=
x
+
1
or
x
in
(
2
,
0
);
>
X
>
-
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论