提交 057a1da4 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Move some tests to createAlias.sql

上级 39592b66
...@@ -103,7 +103,8 @@ public class TestScript extends TestBase { ...@@ -103,7 +103,8 @@ public class TestScript extends TestBase {
"uuid", "varchar", "varchar-ignorecase" }) { "uuid", "varchar", "varchar-ignorecase" }) {
testScript("datatypes/" + s + ".sql"); testScript("datatypes/" + s + ".sql");
} }
for (String s : new String[] { "alterTableAdd", "alterTableDropColumn", "createView", "createTable", for (String s : new String[] { "alterTableAdd", "alterTableDropColumn",
"createAlias", "createView", "createTable",
"dropSchema" }) { "dropSchema" }) {
testScript("ddl/" + s + ".sql"); testScript("ddl/" + s + ".sql");
} }
......
-- 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
--
create alias "SYSDATE" for "java.lang.Integer.parseInt(java.lang.String)";
> exception
create alias "MIN" for "java.lang.Integer.parseInt(java.lang.String)";
> exception
create alias "CAST" for "java.lang.Integer.parseInt(java.lang.String)";
> exception
--- function alias ---------------------------------------------------------------------------------------------
CREATE ALIAS MY_SQRT FOR "java.lang.Math.sqrt";
> ok
SELECT MY_SQRT(2.0) MS, SQRT(2.0);
> MS 1.4142135623730951
> ------------------ ------------------
> 1.4142135623730951 1.4142135623730951
> rows: 1
SELECT MY_SQRT(SUM(X)), SUM(X), MY_SQRT(55) FROM SYSTEM_RANGE(1, 10);
> PUBLIC.MY_SQRT(SUM(X)) SUM(X) PUBLIC.MY_SQRT(55)
> ---------------------- ------ ------------------
> 7.416198487095663 55 7.416198487095663
> rows: 1
SELECT MY_SQRT(-1.0) MS, SQRT(NULL) S;
> MS S
> --- ----
> NaN null
> rows: 1
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ------------------------------------------------------------
> CREATE FORCE ALIAS PUBLIC.MY_SQRT FOR "java.lang.Math.sqrt";
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 2
SELECT ALIAS_NAME, JAVA_CLASS, JAVA_METHOD, DATA_TYPE, COLUMN_COUNT, RETURNS_RESULT, REMARKS FROM INFORMATION_SCHEMA.FUNCTION_ALIASES;
> ALIAS_NAME JAVA_CLASS JAVA_METHOD DATA_TYPE COLUMN_COUNT RETURNS_RESULT REMARKS
> ---------- -------------- ----------- --------- ------------ -------------- -------
> MY_SQRT java.lang.Math sqrt 8 1 2
> rows: 1
DROP ALIAS MY_SQRT;
> ok
...@@ -1689,15 +1689,6 @@ explain select * from test where id in(1, 2, null); ...@@ -1689,15 +1689,6 @@ explain select * from test where id in(1, 2, null);
drop table test; drop table test;
> ok > ok
create alias "SYSDATE" for "java.lang.Integer.parseInt(java.lang.String)";
> exception
create alias "MIN" for "java.lang.Integer.parseInt(java.lang.String)";
> exception
create alias "CAST" for "java.lang.Integer.parseInt(java.lang.String)";
> exception
CREATE TABLE PARENT(A INT, B INT, PRIMARY KEY(A, B)); CREATE TABLE PARENT(A INT, B INT, PRIMARY KEY(A, B));
> ok > ok
...@@ -5099,44 +5090,6 @@ SELECT count(*) FROM test_null WHERE not ('X'=null and 1=0); ...@@ -5099,44 +5090,6 @@ SELECT count(*) FROM test_null WHERE not ('X'=null and 1=0);
drop table if exists test_null; drop table if exists test_null;
> ok > ok
--- function alias ---------------------------------------------------------------------------------------------
CREATE ALIAS MY_SQRT FOR "java.lang.Math.sqrt";
> ok
SELECT MY_SQRT(2.0) MS, SQRT(2.0);
> MS 1.4142135623730951
> ------------------ ------------------
> 1.4142135623730951 1.4142135623730951
> rows: 1
SELECT MY_SQRT(SUM(X)), SUM(X), MY_SQRT(55) FROM SYSTEM_RANGE(1, 10);
> PUBLIC.MY_SQRT(SUM(X)) SUM(X) PUBLIC.MY_SQRT(55)
> ---------------------- ------ ------------------
> 7.416198487095663 55 7.416198487095663
> rows: 1
SELECT MY_SQRT(-1.0) MS, SQRT(NULL) S;
> MS S
> --- ----
> NaN null
> rows: 1
SCRIPT NOPASSWORDS NOSETTINGS;
> SCRIPT
> ------------------------------------------------------------
> CREATE FORCE ALIAS PUBLIC.MY_SQRT FOR "java.lang.Math.sqrt";
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> rows: 2
SELECT ALIAS_NAME, JAVA_CLASS, JAVA_METHOD, DATA_TYPE, COLUMN_COUNT, RETURNS_RESULT, REMARKS FROM INFORMATION_SCHEMA.FUNCTION_ALIASES;
> ALIAS_NAME JAVA_CLASS JAVA_METHOD DATA_TYPE COLUMN_COUNT RETURNS_RESULT REMARKS
> ---------- -------------- ----------- --------- ------------ -------------- -------
> MY_SQRT java.lang.Math sqrt 8 1 2
> rows: 1
DROP ALIAS MY_SQRT;
> ok
--- schema ---------------------------------------------------------------------------------------------- --- schema ----------------------------------------------------------------------------------------------
SELECT DISTINCT TABLE_SCHEMA, TABLE_CATALOG FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_SCHEMA; SELECT DISTINCT TABLE_SCHEMA, TABLE_CATALOG FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_SCHEMA;
> TABLE_SCHEMA TABLE_CATALOG > TABLE_SCHEMA TABLE_CATALOG
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论