提交 4ec22ff8 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Move out some tests from testScript.sql

上级 a048c95b
...@@ -24,3 +24,9 @@ select abs(null) vn, abs(-1) r1, abs(1) r2, abs(0) r3, abs(-0.1) r4, abs(0.1) r5 ...@@ -24,3 +24,9 @@ select abs(null) vn, abs(-1) r1, abs(1) r2, abs(0) r3, abs(-0.1) r4, abs(0.1) r5
> null 1 1 0 0.1 0.1 > null 1 1 0 0.1 0.1
> rows: 1 > rows: 1
select * from table(id int=(1, 2), name varchar=('Hello', 'World')) x order by id;
> ID NAME
> -- -----
> 1 Hello
> 2 World
> rows (ordered): 2
...@@ -87,3 +87,15 @@ select cast(cast(95605327.73 as float) as decimal); ...@@ -87,3 +87,15 @@ select cast(cast(95605327.73 as float) as decimal);
select cast(cast('01020304-0506-0708-090a-0b0c0d0e0f00' as uuid) as binary); select cast(cast('01020304-0506-0708-090a-0b0c0d0e0f00' as uuid) as binary);
>> 0102030405060708090a0b0c0d0e0f00 >> 0102030405060708090a0b0c0d0e0f00
call cast('null' as uuid);
> exception
select cast('12345678123456781234567812345678' as uuid);
>> 12345678-1234-5678-1234-567812345678
select cast('000102030405060708090a0b0c0d0e0f' as uuid);
>> 00010203-0405-0607-0809-0a0b0c0d0e0f
select -cast(0 as double);
>> 0.0
...@@ -26,3 +26,6 @@ select decode('3', 2.0, 2.0, 3, 3.0); ...@@ -26,3 +26,6 @@ select decode('3', 2.0, 2.0, 3, 3.0);
select decode(4.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 9.0); select decode(4.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 9.0);
>> 4.0 >> 4.0
select decode(1, 1, '1', 1, '11') from dual;
>> 1
...@@ -2,3 +2,44 @@ ...@@ -2,3 +2,44 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html). -- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group -- Initial Developer: H2 Group
-- --
select * from table(a int=(1)), table(b int=(2));
> A B
> - -
> 1 2
> rows: 1
create table test as select * from table(id int=(1, 2, 3));
> ok
SELECT * FROM (SELECT * FROM TEST) ORDER BY id;
> ID
> --
> 1
> 2
> 3
> rows (ordered): 3
SELECT * FROM (SELECT * FROM TEST) x ORDER BY id;
> ID
> --
> 1
> 2
> 3
> rows (ordered): 3
drop table test;
> ok
explain select * from table(id int = (1, 2), name varchar=('Hello', 'World'));
> PLAN
> -----------------------------------------------------------------------------------------------------
> SELECT TABLE.ID, TABLE.NAME FROM TABLE(ID INT=(1, 2), NAME VARCHAR=('Hello', 'World')) /* function */
> rows: 1
select * from table(id int=(1, 2), name varchar=('Hello', 'World')) x order by id;
> ID NAME
> -- -----
> 1 Hello
> 2 World
> rows (ordered): 2
...@@ -15,18 +15,6 @@ select * from test where id in (select id from test order by 'x'); ...@@ -15,18 +15,6 @@ select * from test where id in (select id from test order by 'x');
drop table test; drop table test;
> ok > ok
select abs(cast(0.0 as double)) x;
> X
> ---
> 0.0
> rows: 1
select * from table(a int=(1)), table(b int=(2));
> A B
> - -
> 1 2
> rows: 1
select x, x in(2, 3) i from system_range(1, 2) group by x; select x, x in(2, 3) i from system_range(1, 2) group by x;
> X I > X I
> - ----- > - -----
...@@ -144,12 +132,6 @@ select case seq.nextval when 2 then 'two' when 3 then 'three' when 1 then 'one' ...@@ -144,12 +132,6 @@ select case seq.nextval when 2 then 'two' when 3 then 'three' when 1 then 'one'
drop sequence seq; drop sequence seq;
> ok > ok
select decode(1, 1, '1', 1, '11') r from dual;
> R
> -
> 1
> rows: 1
create table test(x int); create table test(x int);
> ok > ok
...@@ -236,9 +218,6 @@ update test set pid = 1 where id = 2; ...@@ -236,9 +218,6 @@ update test set pid = 1 where id = 2;
drop table test; drop table test;
> ok > ok
call cast('null' as uuid);
> exception
create table test(name varchar(255)); create table test(name varchar(255));
> ok > ok
...@@ -420,12 +399,6 @@ explain select -cast(0 as real), -cast(0 as double); ...@@ -420,12 +399,6 @@ explain select -cast(0 as real), -cast(0 as double);
> SELECT 0.0, 0.0 FROM SYSTEM_RANGE(1, 1) /* PUBLIC.RANGE_INDEX */ > SELECT 0.0, 0.0 FROM SYSTEM_RANGE(1, 1) /* PUBLIC.RANGE_INDEX */
> rows: 1 > rows: 1
select -cast(0 as double) nz;
> NZ
> ---
> 0.0
> rows: 1
select () empty; select () empty;
> EMPTY > EMPTY
> ----- > -----
...@@ -1400,28 +1373,6 @@ DROP ROLE Y; ...@@ -1400,28 +1373,6 @@ DROP ROLE Y;
DROP ROLE X; DROP ROLE X;
> ok > ok
create table test as select * from table(id int=(1, 2, 3));
> ok
SELECT * FROM (SELECT * FROM TEST) ORDER BY id;
> ID
> --
> 1
> 2
> 3
> rows (ordered): 3
SELECT * FROM (SELECT * FROM TEST) x ORDER BY id;
> ID
> --
> 1
> 2
> 3
> rows (ordered): 3
drop table test;
> ok
select top sum(1) 0 from dual; select top sum(1) 0 from dual;
> exception > exception
...@@ -2064,12 +2015,6 @@ select * from V, C where V.V = C.C; ...@@ -2064,12 +2015,6 @@ select * from V, C where V.V = C.C;
drop table A, B, C, V cascade; drop table A, B, C, V cascade;
> ok > ok
explain select * from table(id int = (1, 2), name varchar=('Hello', 'World'));
> PLAN
> -----------------------------------------------------------------------------------------------------
> SELECT TABLE.ID, TABLE.NAME FROM TABLE(ID INT=(1, 2), NAME VARCHAR=('Hello', 'World')) /* function */
> rows: 1
CREATE TABLE TEST(ID INT PRIMARY KEY, FLAG BOOLEAN, NAME VARCHAR); CREATE TABLE TEST(ID INT PRIMARY KEY, FLAG BOOLEAN, NAME VARCHAR);
> ok > ok
...@@ -2275,13 +2220,6 @@ select (1, 2); ...@@ -2275,13 +2220,6 @@ select (1, 2);
> (1, 2) > (1, 2)
> rows: 1 > rows: 1
select * from table(id int=(1, 2), name varchar=('Hello', 'World')) x order by id;
> ID NAME
> -- -----
> 1 Hello
> 2 World
> rows (ordered): 2
create table array_test(x array); create table array_test(x array);
> ok > ok
...@@ -2790,18 +2728,6 @@ drop view address_view; ...@@ -2790,18 +2728,6 @@ drop view address_view;
drop table address; drop table address;
> ok > ok
select cast('12345678123456781234567812345678' as uuid);
> '12345678-1234-5678-1234-567812345678'
> --------------------------------------
> 12345678-1234-5678-1234-567812345678
> rows: 1
select cast('000102030405060708090a0b0c0d0e0f' as uuid);
> '00010203-0405-0607-0809-0a0b0c0d0e0f'
> --------------------------------------
> 00010203-0405-0607-0809-0a0b0c0d0e0f
> rows: 1
CREATE ALIAS PARSE_INT2 FOR "java.lang.Integer.parseInt(java.lang.String, int)"; CREATE ALIAS PARSE_INT2 FOR "java.lang.Integer.parseInt(java.lang.String, int)";
> ok > ok
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论