Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e2871b57
提交
e2871b57
authored
4月 19, 2018
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix script
上级
66427536
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
1333 行增加
和
2 行删除
+1333
-2
createTrigger.sql
h2/src/test/org/h2/test/scripts/ddl/createTrigger.sql
+2
-2
n1.diff
n1.diff
+1331
-0
没有找到文件。
h2/src/test/org/h2/test/scripts/ddl/createTrigger.sql
浏览文件 @
e2871b57
...
...
@@ -34,14 +34,14 @@ drop table items, count;
-- PostgreSQL syntax tests
-- ---------------------------------------------------------------------------
set
mode
postgesql
;
set
mode
postg
r
esql
;
>
ok
CREATE
TABLE
COUNT
(
X
INT
);
>
ok
INSERT
INTO
COUNT
VALUES
(
1
);
>
ok
>
update
count
:
1
CREATE
FORCE
TRIGGER
T_COUNT
BEFORE
INSERT
OR
UPDATE
ON
COUNT
CALL
"com.Unknown"
;
>
ok
...
...
n1.diff
0 → 100644
浏览文件 @
e2871b57
diff --git a/h2/src/test/org/h2/test/scripts/TestScript.java b/h2/src/test/org/h2/test/scripts/TestScript.java
index fa250dc83..d219e0171 100644
--- a/h2/src/test/org/h2/test/scripts/TestScript.java
+++ b/h2/src/test/org/h2/test/scripts/TestScript.java
@@ -11,6 +11,8 @@
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -18,8 +20,10 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Random;
-import org.h2.engine.SysProperties;
+import org.h2.api.ErrorCode;
import org.h2.test.TestAll;
import org.h2.test.TestBase;
import org.h2.util.New;
@@ -80,80 +84,80 @@ public void test() throws Exception {
}
reconnectOften = !config.memory && config.big;
- testScript("testScript.sql");
- testScript("derived-column-names.sql");
- testScript("information_schema.sql");
+// testScript("testScript.sql");
+// testScript("derived-column-names.sql");
+// testScript("information_schema.sql");
testScript("joins.sql");
- testScript("range_table.sql");
- testScript("altertable-index-reuse.sql");
- testScript("default-and-on_update.sql");
- testScript("query-optimisations.sql");
- String decimal2;
- if (SysProperties.BIG_DECIMAL_IS_DECIMAL) {
- decimal2 = "decimal_decimal";
- } else {
- decimal2 = "decimal_numeric";
- }
-
- for (String s : new String[] { "array", "bigint", "binary", "blob",
- "boolean", "char", "clob", "date", "decimal", decimal2, "double", "enum",
- "geometry", "identity", "int", "other", "real", "smallint",
- "time", "timestamp-with-timezone", "timestamp", "tinyint",
- "uuid", "varchar", "varchar-ignorecase" }) {
- testScript("datatypes/" + s + ".sql");
- }
- for (String s : new String[] { "alterTableAdd", "alterTableDropColumn",
- "createAlias", "createView", "createTable", "createTrigger",
- "dropSchema" }) {
- testScript("ddl/" + s + ".sql");
- }
- for (String s : new String[] { "error_reporting", "insertIgnore",
- "mergeUsing", "script", "with" }) {
- testScript("dml/" + s + ".sql");
- }
- for (String s : new String[] { "avg", "bit-and", "bit-or", "count",
- "group-concat", "max", "median", "min", "selectivity", "stddev-pop",
- "stddev-samp", "sum", "var-pop", "var-samp", "array-agg" }) {
- testScript("functions/aggregate/" + s + ".sql");
- }
- for (String s : new String[] { "abs", "acos", "asin", "atan", "atan2",
- "bitand", "bitget", "bitor", "bitxor", "ceil", "compress",
- "cos", "cosh", "cot", "decrypt", "degrees", "encrypt", "exp",
- "expand", "floor", "hash", "length", "log", "mod", "ora-hash", "pi",
- "power", "radians", "rand", "random-uuid", "round",
- "roundmagic", "secure-rand", "sign", "sin", "sinh", "sqrt",
- "tan", "tanh", "truncate", "zero" }) {
- testScript("functions/numeric/" + s + ".sql");
- }
- for (String s : new String[] { "ascii", "bit-length", "char", "concat",
- "concat-ws", "difference", "hextoraw", "insert", "instr",
- "left", "length", "locate", "lower", "lpad", "ltrim",
- "octet-length", "position", "rawtohex", "regexp-like",
- "regex-replace", "repeat", "replace", "right", "rpad", "rtrim",
- "soundex", "space", "stringdecode", "stringencode",
- "stringtoutf8", "substring", "to-char", "translate", "trim",
- "upper", "utf8tostring", "xmlattr", "xmlcdata", "xmlcomment",
- "xmlnode", "xmlstartdoc", "xmltext" }) {
- testScript("functions/string/" + s + ".sql");
- }
- for (String s : new String[] { "array-contains", "array-get",
- "array-length", "autocommit", "cancel-session", "casewhen",
- "cast", "coalesce", "convert", "csvread", "csvwrite", "currval",
- "database-path", "database", "decode", "disk-space-used",
- "file-read", "file-write", "greatest", "h2version", "identity",
- "ifnull", "least", "link-schema", "lock-mode", "lock-timeout",
- "memory-free", "memory-used", "nextval", "nullif", "nvl2",
- "readonly", "rownum", "schema", "scope-identity", "session-id",
- "set", "table", "transaction-id", "truncate-value", "user" }) {
- testScript("functions/system/" + s + ".sql");
- }
- for (String s : new String[] { "add_months", "current_date", "current_timestamp",
- "current-time", "dateadd", "datediff", "dayname",
- "day-of-month", "day-of-week", "day-of-year", "extract",
- "formatdatetime", "hour", "minute", "month", "monthname",
- "parsedatetime", "quarter", "second", "truncate", "week", "year", "date_trunc" }) {
- testScript("functions/timeanddate/" + s + ".sql");
- }
+// testScript("range_table.sql");
+// testScript("altertable-index-reuse.sql");
+// testScript("default-and-on_update.sql");
+// testScript("query-optimisations.sql");
+// String decimal2;
+// if (SysProperties.BIG_DECIMAL_IS_DECIMAL) {
+// decimal2 = "decimal_decimal";
+// } else {
+// decimal2 = "decimal_numeric";
+// }
+//
+// for (String s : new String[] { "array", "bigint", "binary", "blob",
+// "boolean", "char", "clob", "date", "decimal", decimal2, "double", "enum",
+// "geometry", "identity", "int", "other", "real", "smallint",
+// "time", "timestamp-with-timezone", "timestamp", "tinyint",
+// "uuid", "varchar", "varchar-ignorecase" }) {
+// testScript("datatypes/" + s + ".sql");
+// }
+// for (String s : new String[] { "alterTableAdd", "alterTableDropColumn",
+// "createAlias", "createView", "createTable", "createTrigger",
+// "dropSchema" }) {
+// testScript("ddl/" + s + ".sql");
+// }
+// for (String s : new String[] { "error_reporting", "insertIgnore",
+// "mergeUsing", "script", "with" }) {
+// testScript("dml/" + s + ".sql");
+// }
+// for (String s : new String[] { "avg", "bit-and", "bit-or", "count",
+// "group-concat", "max", "median", "min", "selectivity", "stddev-pop",
+// "stddev-samp", "sum", "var-pop", "var-samp", "array-agg" }) {
+// testScript("functions/aggregate/" + s + ".sql");
+// }
+// for (String s : new String[] { "abs", "acos", "asin", "atan", "atan2",
+// "bitand", "bitget", "bitor", "bitxor", "ceil", "compress",
+// "cos", "cosh", "cot", "decrypt", "degrees", "encrypt", "exp",
+// "expand", "floor", "hash", "length", "log", "mod", "ora-hash", "pi",
+// "power", "radians", "rand", "random-uuid", "round",
+// "roundmagic", "secure-rand", "sign", "sin", "sinh", "sqrt",
+// "tan", "tanh", "truncate", "zero" }) {
+// testScript("functions/numeric/" + s + ".sql");
+// }
+// for (String s : new String[] { "ascii", "bit-length", "char", "concat",
+// "concat-ws", "difference", "hextoraw", "insert", "instr",
+// "left", "length", "locate", "lower", "lpad", "ltrim",
+// "octet-length", "position", "rawtohex", "regexp-like",
+// "regex-replace", "repeat", "replace", "right", "rpad", "rtrim",
+// "soundex", "space", "stringdecode", "stringencode",
+// "stringtoutf8", "substring", "to-char", "translate", "trim",
+// "upper", "utf8tostring", "xmlattr", "xmlcdata", "xmlcomment",
+// "xmlnode", "xmlstartdoc", "xmltext" }) {
+// testScript("functions/string/" + s + ".sql");
+// }
+// for (String s : new String[] { "array-contains", "array-get",
+// "array-length", "autocommit", "cancel-session", "casewhen",
+// "cast", "coalesce", "convert", "csvread", "csvwrite", "currval",
+// "database-path", "database", "decode", "disk-space-used",
+// "file-read", "file-write", "greatest", "h2version", "identity",
+// "ifnull", "least", "link-schema", "lock-mode", "lock-timeout",
+// "memory-free", "memory-used", "nextval", "nullif", "nvl2",
+// "readonly", "rownum", "schema", "scope-identity", "session-id",
+// "set", "table", "transaction-id", "truncate-value", "user" }) {
+// testScript("functions/system/" + s + ".sql");
+// }
+// for (String s : new String[] { "add_months", "current_date", "current_timestamp",
+// "current-time", "dateadd", "datediff", "dayname",
+// "day-of-month", "day-of-week", "day-of-year", "extract",
+// "formatdatetime", "hour", "minute", "month", "monthname",
+// "parsedatetime", "quarter", "second", "truncate", "week", "year", "date_trunc" }) {
+// testScript("functions/timeanddate/" + s + ".sql");
+// }
deleteDb("script");
System.out.flush();
@@ -454,16 +458,30 @@ private static String format(String[] row, int[] max) {
return buff.toString();
}
- private void writeException(String sql, SQLException e) throws Exception {
- writeResult(sql, "exception", e);
+ /** Convert the error code to a symbolic name from ErrorCode. */
+ private static final Map<Integer, String> ERROR_CODE_TO_NAME = new HashMap<>();
+ static {
+ try {
+ for (Field field : ErrorCode.class.getDeclaredFields()) {
+ if (Modifier.isStatic(field.getModifiers())) {
+ ERROR_CODE_TO_NAME.put(field.getInt(null), field.getName());
+ }
+ }
+ } catch (IllegalAccessException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private void writeException(String sql, SQLException ex) throws Exception {
+ writeResult(sql, "exception " + ERROR_CODE_TO_NAME.get(ex.getErrorCode()), ex);
}
- private void writeResult(String sql, String s, SQLException e) throws Exception {
- writeResult(sql, s, e, "> ");
+ private void writeResult(String sql, String s, SQLException ex) throws Exception {
+ writeResult(sql, s, ex, "> ");
}
- private void writeResult(String sql, String s, SQLException e, String prefix) throws Exception {
- assertKnownException(sql, e);
+ private void writeResult(String sql, String s, SQLException ex, String prefix) throws Exception {
+ assertKnownException(sql, ex);
s = (prefix + s).trim();
String compare = readLine();
if (compare != null && compare.startsWith(">")) {
@@ -472,11 +490,11 @@ private void writeResult(String sql, String s, SQLException e, String prefix) th
return;
}
errors.append(fileName).append('\n');
- errors.append("line: ").append(outputLineNo).append('\n');
+ errors.append("line: ").append(in.getLineNumber()).append('\n');
errors.append("exp: ").append(compare).append('\n');
errors.append("got: ").append(s).append('\n');
- if (e != null) {
- TestBase.logError("script", e);
+ if (ex != null) {
+ TestBase.logError("script", ex);
}
TestBase.logErrorMessage(errors.toString());
if (failFast) {
diff --git a/h2/src/test/org/h2/test/scripts/derived-column-names.sql b/h2/src/test/org/h2/test/scripts/derived-column-names.sql
index 83ad7cc0b..04eec004f 100644
--- a/h2/src/test/org/h2/test/scripts/derived-column-names.sql
+++ b/h2/src/test/org/h2/test/scripts/derived-column-names.sql
@@ -34,16 +34,16 @@ SELECT A AS A1, B AS B1 FROM (VALUES(1, 2)) AS T(A, B) WHERE A <> B;
> rows: 1
SELECT A AS A1, B AS B1 FROM (VALUES(1, 2)) AS T(A, B) WHERE A1 <> B1;
-> exception
+> exception COLUMN_NOT_FOUND_1
SELECT * FROM (VALUES(1, 2)) AS T(A);
-> exception
+> exception COLUMN_COUNT_DOES_NOT_MATCH
SELECT * FROM (VALUES(1, 2)) AS T(A, a);
-> exception
+> exception DUPLICATE_COLUMN_NAME_1
SELECT * FROM (VALUES(1, 2)) AS T(A, B, C);
-> exception
+> exception COLUMN_COUNT_DOES_NOT_MATCH
SELECT V AS V1, A AS A1, B AS B1 FROM (VALUES (1)) T1(V) INNER JOIN (VALUES(1, 2)) T2(A, B) ON V = A;
> V1 A1 B1
@@ -80,3 +80,4 @@ SELECT * FROM TEST AS T(A, B) USE INDEX (TEST_I_IDX);
DROP TABLE TEST;
> ok
+
diff --git a/h2/src/test/org/h2/test/scripts/joins.sql b/h2/src/test/org/h2/test/scripts/joins.sql
index 011236d27..eb963bdd1 100644
--- a/h2/src/test/org/h2/test/scripts/joins.sql
+++ b/h2/src/test/org/h2/test/scripts/joins.sql
@@ -84,7 +84,7 @@ INSERT INTO PARENT VALUES(1);
> update count: 1
SELECT * FROM PARENT P LEFT OUTER JOIN CHILD C ON C.PARENTID=P.ID;
-> exception
+> exception COLUMN_NOT_FOUND_1
DROP TABLE PARENT, CHILD;
> ok
@@ -380,7 +380,7 @@ select * from left_hand left join right_hand on left_hand.id=right_hand.id where
-- h2: 0 (2 cols); postgresql: 0 (1 col), mysql: exception; derby, hsqldb: no natural join
select * from left_hand natural join right_hand where left_hand.id=1 having right_hand.id=2;
-> exception
+> exception MUST_GROUP_BY_COLUMN_1
-- h2, mysql, hsqldb: 0 rows; postgresql, derby: exception
select * from left_hand left outer join right_hand on left_hand.id=right_hand.id where left_hand.id=1 group by left_hand.id having right_hand.id=2;
@@ -764,21 +764,49 @@ DROP TABLE C;
> ok
CREATE TABLE T1(X1 INT);
+> ok
+
CREATE TABLE T2(X2 INT);
+> ok
+
CREATE TABLE T3(X3 INT);
+> ok
+
CREATE TABLE T4(X4 INT);
+> ok
+
CREATE TABLE T5(X5 INT);
+> ok
INSERT INTO T1 VALUES (1);
+> update count: 1
+
INSERT INTO T1 VALUES (NULL);
+> update count: 1
+
INSERT INTO T2 VALUES (1);
+> update count: 1
+
INSERT INTO T2 VALUES (NULL);
+> update count: 1
+
INSERT INTO T3 VALUES (1);
+> update count: 1
+
INSERT INTO T3 VALUES (NULL);
+> update count: 1
+
INSERT INTO T4 VALUES (1);
+> update count: 1
+
INSERT INTO T4 VALUES (NULL);
+> update count: 1
+
INSERT INTO T5 VALUES (1);
+> update count: 1
+
INSERT INTO T5 VALUES (NULL);
+> update count: 1
SELECT T1.X1, T2.X2, T3.X3, T4.X4, T5.X5 FROM (
T1 INNER JOIN (
@@ -786,8 +814,9 @@ SELECT T1.X1, T2.X2, T3.X3, T4.X4, T5.X5 FROM (
T3 INNER JOIN T4 ON T3.X3 = T4.X4
) ON T2.X2 = T4.X4
) ON T1.X1 = T2.X2
-) INNER JOIN T5 ON T2.X2 = T5.X5;
+) INNER JOIN T5 ON T2.X2 = T5.X5;
> X1 X2 X3 X4 X5
> -- -- -- -- --
> 1 1 1 1 1
> rows: 1
+
diff --git a/h2/src/test/org/h2/test/scripts/testScript.sql b/h2/src/test/org/h2/test/scripts/testScript.sql
index 6eb4dd68f..774a617bb 100644
--- a/h2/src/test/org/h2/test/scripts/testScript.sql
+++ b/h2/src/test/org/h2/test/scripts/testScript.sql
@@ -213,7 +213,7 @@ insert into test values (2, null);
> update count: 1
update test set pid = 1 where id = 2;
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
drop table test;
> ok
@@ -222,7 +222,7 @@ create table test(name varchar(255));
> ok
select * from test union select * from test order by test.name;
-> exception
+> exception ORDER_BY_NOT_IN_RESULT
insert into test values('a'), ('b'), ('c');
> update count: 3
@@ -305,7 +305,7 @@ drop table test;
> ok
select x from dual order by y.x;
-> exception
+> exception COLUMN_NOT_FOUND_1
create table test(id int primary key, name varchar(255), row_number int);
> ok
@@ -361,7 +361,7 @@ drop table test;
> ok
select 2^2;
-> exception
+> exception SYNTAX_ERROR_1
select * from dual where x in (select x from dual group by x order by max(x));
> X
@@ -370,7 +370,7 @@ select * from dual where x in (select x from dual group by x order by max(x));
> rows (ordered): 1
create table test(d decimal(1, 2));
-> exception
+> exception INVALID_VALUE_SCALE_PRECISION
call truncate_value('Test 123', 4, false);
> 'Test'
@@ -379,7 +379,7 @@ call truncate_value('Test 123', 4, false);
> rows: 1
call truncate_value(1234567890.123456789, 4, false);
-> exception
+> exception NUMERIC_VALUE_OUT_OF_RANGE_1
call truncate_value(1234567890.123456789, 4, true);
> 1234567890.1234567
@@ -501,7 +501,7 @@ create table test(id x);
> ok
insert into test values(null);
-> exception
+> exception NULL_NOT_ALLOWED
drop table test;
> ok
@@ -587,7 +587,7 @@ create view x as select * from test;
> ok
drop table test restrict;
-> exception
+> exception CANNOT_DROP_2
drop table test cascade;
> ok
@@ -631,7 +631,7 @@ delete from a where x = 0 and y is null;
> update count: 1
delete from a where x = 0 and y = 0;
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1
drop table b;
> ok
@@ -648,7 +648,7 @@ create table test(a int primary key, b int references(a));
> ok
merge into test values(1, 2);
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
drop table test;
> ok
@@ -825,13 +825,13 @@ create table test(id identity);
> ok
set password test;
-> exception
+> exception COLUMN_NOT_FOUND_1
alter user sa set password test;
-> exception
+> exception COLUMN_NOT_FOUND_1
comment on table test is test;
-> exception
+> exception COLUMN_NOT_FOUND_1
select 1 from test a where 1 in(select 1 from test b where b.id in(select 1 from test c where c.id=a.id));
> 1
@@ -851,7 +851,7 @@ select @n := case when x = 1 then 1 else @n * x end f from system_range(1, 4);
> rows: 4
select * from (select "x" from dual);
-> exception
+> exception COLUMN_NOT_FOUND_1
select * from(select 1 from system_range(1, 2) group by sin(x) order by sin(x));
> 1
@@ -867,13 +867,13 @@ create table child(id int references parent(id)) as select 1;
> ok
delete from parent;
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1
drop table parent, child;
> ok
create domain integer as varchar;
-> exception
+> exception USER_DATA_TYPE_ALREADY_EXISTS_1
create domain int as varchar;
> ok
@@ -903,13 +903,13 @@ insert into test values(0, 0), (1, NULL), (2, 1), (3, 3), (4, 3);
> update count: 5
delete from test where id = 3;
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1
delete from test where id = 0;
> update count: 1
delete from test where id = 1;
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1
drop table test;
> ok
@@ -986,13 +986,13 @@ select 1 as id, id as b, count(*) from test group by id;
> rows: 2
select id+1 as x, count(*) from test group by -x;
-> exception
+> exception COLUMN_NOT_FOUND_1
select id+1 as x, count(*) from test group by x having x>2;
-> exception
+> exception MUST_GROUP_BY_COLUMN_1
select id+1 as x, count(*) from test group by 1;
-> exception
+> exception MUST_GROUP_BY_COLUMN_1
drop table test;
> ok
@@ -1141,7 +1141,7 @@ CREATE ROLE TEST_A;
> ok
GRANT TEST_A TO TEST_A;
-> exception
+> exception ROLE_ALREADY_GRANTED_1
CREATE ROLE TEST_B;
> ok
@@ -1150,7 +1150,7 @@ GRANT TEST_A TO TEST_B;
> ok
GRANT TEST_B TO TEST_A;
-> exception
+> exception ROLE_ALREADY_GRANTED_1
DROP ROLE TEST_A;
> ok
@@ -1194,7 +1194,7 @@ drop table test;
> ok
alter table information_schema.help rename to information_schema.help2;
-> exception
+> exception FEATURE_NOT_SUPPORTED_1
help abc;
> ID SECTION TOPIC SYNTAX TEXT
@@ -1359,7 +1359,7 @@ CREATE ROLE X;
> ok
GRANT X TO X;
-> exception
+> exception ROLE_ALREADY_GRANTED_1
CREATE ROLE Y;
> ok
@@ -1374,7 +1374,7 @@ DROP ROLE X;
> ok
select top sum(1) 0 from dual;
-> exception
+> exception SYNTAX_ERROR_1
create table test(id int primary key, name varchar) as select 1, 'Hello World';
> ok
@@ -1389,7 +1389,7 @@ drop table test;
> ok
select rtrim() from dual;
-> exception
+> exception INVALID_PARAMETER_COUNT_2
CREATE TABLE TEST(ID INT PRIMARY KEY, LABEL CHAR(20), LOOKUP CHAR(30));
> ok
@@ -1408,13 +1408,13 @@ DROP TABLE TEST;
> ok
call 'a' regexp 'Ho.*\';
-> exception
+> exception LIKE_ESCAPE_ERROR_1
set @t = 0;
> ok
call set(1, 2);
-> exception
+> exception CAN_ONLY_ASSIGN_TO_VARIABLE_1
select x, set(@t, ifnull(@t, 0) + x) from system_range(1, 3);
> X SET(@T, (IFNULL(@T, 0) + X))
@@ -1516,7 +1516,7 @@ CREATE TABLE TEST(ID INTEGER NOT NULL, ID2 INTEGER DEFAULT 0);
> ok
ALTER TABLE test ALTER COLUMN ID2 RENAME TO ID;
-> exception
+> exception DUPLICATE_COLUMN_NAME_1
drop table test;
> ok
@@ -1603,7 +1603,7 @@ select * from dual where x = 1000000000000000000000;
> rows: 0
select * from dual where x = 'Hello';
-> exception
+> exception DATA_CONVERSION_ERROR_1
create table test(id smallint primary key);
> ok
@@ -1765,7 +1765,7 @@ ALTER TABLE A SET REFERENTIAL_INTEGRITY FALSE;
> ok
ALTER TABLE A SET REFERENTIAL_INTEGRITY TRUE CHECK;
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
DROP TABLE A;
> ok
@@ -1786,7 +1786,7 @@ INSERT INTO CHILD VALUES(2);
> update count: 1
ALTER TABLE CHILD ADD CONSTRAINT CP FOREIGN KEY(PID) REFERENCES PARENT(ID);
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
UPDATE CHILD SET PID=1;
> update count: 1
@@ -1804,7 +1804,7 @@ INSERT INTO A VALUES(1, 2);
> update count: 1
ALTER TABLE A ADD CONSTRAINT AC FOREIGN KEY(SK) REFERENCES A(ID);
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
DROP TABLE A;
> ok
@@ -1816,7 +1816,7 @@ INSERT INTO TEST VALUES(0), (1), (100);
> update count: 3
ALTER TABLE TEST ADD CONSTRAINT T CHECK ID<100;
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
UPDATE TEST SET ID=20 WHERE ID=100;
> update count: 1
@@ -1882,7 +1882,7 @@ insert into test values(1, 1);
> update count: 1
insert into test values(2, 3);
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
set autocommit false;
> ok
@@ -1900,7 +1900,7 @@ set referential_integrity true;
> ok
insert into test values(7, 7), (8, 9);
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
set autocommit true;
> ok
@@ -2053,7 +2053,7 @@ create table d(d double, r real);
> ok
insert into d(d, d, r) values(1.1234567890123456789, 1.1234567890123456789, 3);
-> exception
+> exception DUPLICATE_COLUMN_NAME_1
insert into d values(1.1234567890123456789, 1.1234567890123456789);
> update count: 1
@@ -2239,7 +2239,7 @@ drop all objects;
> ok
call abc;
-> exception
+> exception COLUMN_NOT_FOUND_1
create table FOO(id integer primary key);
> ok
@@ -2254,7 +2254,7 @@ truncate table bar;
> ok
truncate table foo;
-> exception
+> exception CANNOT_TRUNCATE_1
drop table bar, foo;
> ok
@@ -2528,7 +2528,7 @@ insert into content values(0, 0), (0, 0);
> update count: 2
insert into content values(0, 1);
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
insert into content values(1, 1), (2, 2);
> update count: 2
@@ -2537,7 +2537,7 @@ insert into content values(2, 1);
> update count: 1
insert into content values(2, 3);
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
drop table content;
> ok
@@ -2613,7 +2613,7 @@ select id/(10*100) from test group by id/(10*100);
> rows: 1
select id/1000 from test group by id/100;
-> exception
+> exception MUST_GROUP_BY_COLUMN_1
drop table test;
> ok
@@ -2697,7 +2697,7 @@ insert into test values(null);
> update count: 1
insert into test values('aa');
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
insert into test values('AA');
> update count: 1
@@ -2726,13 +2726,13 @@ insert into address(id, name, name2) values(1, 'test@abc', 'test@gmail.com');
> update count: 1
insert into address(id, name, name2) values(2, 'test@abc', 'test@acme');
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
insert into address(id, name, name2) values(3, 'test_abc', 'test@gmail');
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
insert into address2(name) values('test@abc');
-> exception
+> exception TABLE_OR_VIEW_NOT_FOUND_1
CREATE DOMAIN STRING AS VARCHAR(255) DEFAULT '' NOT NULL;
> ok
@@ -2825,7 +2825,7 @@ create force view address_view as select * from address;
> ok
create table address(id identity, name varchar check instr(value, '@') > 1);
-> exception
+> exception COLUMN_NOT_FOUND_1
create table address(id identity, name varchar check instr(name, '@') > 1);
> ok
@@ -2855,7 +2855,7 @@ create table c();
> ok
drop table information_schema.columns;
-> exception
+> exception CANNOT_DROP_TABLE_1
create table columns as select * from information_schema.columns;
> ok
@@ -3079,7 +3079,7 @@ INSERT INTO TEST2 VALUES(2, 'World');
> update count: 1
INSERT INTO TEST2 VALUES(3, 'WoRlD');
-> exception
+> exception DUPLICATE_KEY_1
drop index idx_test2_name;
> ok
@@ -3325,7 +3325,7 @@ create force view t1 as select * from t1;
> ok
select * from t1;
-> exception
+> exception VIEW_IS_INVALID_2
drop table t1;
> ok
@@ -3506,10 +3506,10 @@ select count(*) from test where id in ((select id from test));
> rows: 1
select count(*) from test where id = ((select id from test));
-> exception
+> exception SCALAR_SUBQUERY_CONTAINS_MORE_THAN_ONE_ROW
select count(*) from test where id = ((select id from test), 1);
-> exception
+> exception COMPARING_ARRAY_TO_SCALAR
select (select id from test where 1=0) from test;
> SELECT ID FROM PUBLIC.TEST /* PUBLIC.TEST.tableScan: FALSE */ WHERE FALSE
@@ -3561,7 +3561,7 @@ insert into test values(6, 'F');
> update count: 1
select max(id) from test where id = max(id) group by id;
-> exception
+> exception INVALID_USE_OF_AGGREGATE_FUNCTION_1
select * from test where a=TRUE=a;
> ID A
@@ -3636,13 +3636,13 @@ create table test (id identity, value int not null);
> ok
create primary key on test(id);
-> exception
+> exception SECOND_PRIMARY_KEY
alter table test drop primary key;
> ok
alter table test drop primary key;
-> exception
+> exception INDEX_NOT_FOUND_1
create primary key on test(id, id, id);
> ok
@@ -3799,7 +3799,7 @@ select test."ID" from test;
> rows: 0
select test."id" from test;
-> exception
+> exception COLUMN_NOT_FOUND_1
select "TEST"."ID" from test;
> ID
@@ -3807,7 +3807,7 @@ select "TEST"."ID" from test;
> rows: 0
select "test"."ID" from test;
-> exception
+> exception COLUMN_NOT_FOUND_1
select public."TEST".id from test;
> ID
@@ -3825,7 +3825,7 @@ select public."TEST"."ID" from test;
> rows: 0
select public."test"."ID" from test;
-> exception
+> exception COLUMN_NOT_FOUND_1
select "PUBLIC"."TEST".id from test;
> ID
@@ -3843,7 +3843,7 @@ select public."TEST"."ID" from test;
> rows: 0
select "public"."TEST"."ID" from test;
-> exception
+> exception COLUMN_NOT_FOUND_1
drop table test;
> ok
@@ -4026,7 +4026,7 @@ create table test(ID INT default next value for seq1);
> ok
drop sequence seq1;
-> exception
+> exception CANNOT_DROP_2
alter table test add column name varchar;
> ok
@@ -4127,7 +4127,7 @@ INSERT INTO CHILD VALUES(1, '1');
> update count: 1
INSERT INTO CHILD VALUES(2, 'Hello');
-> exception
+> exception DATA_CONVERSION_ERROR_1
DROP TABLE IF EXISTS CHILD;
> ok
@@ -4295,13 +4295,13 @@ INSERT INTO label VALUES ( 0, 0, 0, 'TEST');
> update count: 1
INSERT INTO label VALUES ( 1, 0, 0, 'TEST');
-> exception
+> exception DUPLICATE_KEY_1
INSERT INTO label VALUES ( 1, 0, 0, 'TEST1');
> update count: 1
INSERT INTO label VALUES ( 2, 2, 1, 'TEST');
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
drop table label;
> ok
@@ -4430,7 +4430,7 @@ TRUNCATE TABLE CHILD;
> ok
TRUNCATE TABLE PARENT;
-> exception
+> exception CANNOT_TRUNCATE_1
DROP TABLE CHILD;
> ok
@@ -4522,19 +4522,19 @@ EXPLAIN MERGE INTO TEST(ID, NAME) KEY(ID) VALUES(3, 'How do you do');
> rows: 1
MERGE INTO TEST(ID, NAME) KEY(NAME) VALUES(3, 'Fine');
-> exception
+> exception LOCK_TIMEOUT_1
MERGE INTO TEST(ID, NAME) KEY(NAME) VALUES(4, 'Fine!');
> update count: 1
MERGE INTO TEST(ID, NAME) KEY(NAME) VALUES(4, 'Fine! And you');
-> exception
+> exception LOCK_TIMEOUT_1
MERGE INTO TEST(ID, NAME) KEY(NAME, ID) VALUES(5, 'I''m ok');
> update count: 1
MERGE INTO TEST(ID, NAME) KEY(NAME, ID) VALUES(5, 'Oh, fine');
-> exception
+> exception DUPLICATE_KEY_1
MERGE INTO TEST(ID, NAME) VALUES(6, 'Oh, fine.');
> update count: 1
@@ -4953,7 +4953,7 @@ select * from test;
> rows: 4
UPDATE test SET name='Hi';
-> exception
+> exception DUPLICATE_KEY_1
select * from test;
> ID NAME B
@@ -5254,7 +5254,7 @@ CREATE UNIQUE INDEX IDX_NAME_ID ON TEST(ID, NAME);
> ok
ALTER TABLE TEST DROP COLUMN NAME;
-> exception
+> exception COLUMN_IS_REFERENCED_1
DROP INDEX IDX_NAME_ID;
> ok
@@ -5982,7 +5982,7 @@ DROP VIEW CHILDREN_CLASSES;
> ok
DROP VIEW CHILDREN_CLASS12;
-> exception
+> exception VIEW_NOT_FOUND_1
CREATE VIEW V_UNION AS SELECT * FROM CHILDREN UNION ALL SELECT * FROM CHILDREN;
> ok
@@ -6143,7 +6143,7 @@ DROP TABLE TEST_B cascade;
> ok
DROP VIEW TEST_ALL;
-> exception
+> exception VIEW_NOT_FOUND_1
DROP VIEW IF EXISTS TEST_ALL;
> ok
@@ -6176,7 +6176,7 @@ INSERT INTO TEST VALUES(2, 'World');
> update count: 1
ROLLBACK TO SAVEPOINT NOT_EXISTING;
-> exception
+> exception SAVEPOINT_IS_INVALID_1
ROLLBACK TO SAVEPOINT TEST;
> ok
@@ -6256,16 +6256,16 @@ DROP TABLE TEST;
--- syntax errors ----------------------------------------------------------------------------------------------
CREATE SOMETHING STRANGE;
-> exception
+> exception SYNTAX_ERROR_2
SELECT T1.* T2;
-> exception
+> exception SYNTAX_ERROR_1
select replace('abchihihi', 'i', 'o') abcehohoho, replace('this is tom', 'i') 1e_th_st_om from test;
-> exception
+> exception SYNTAX_ERROR_1
select monthname(date )'005-0E9-12') d_set fm test;
-> exception
+> exception SYNTAX_ERROR_1
call substring('bob', 2, -1);
> ''
@@ -6436,10 +6436,10 @@ SELECT * FROM TEST;
> rows: 1
DROP_ TABLE_ TEST_T;
-> exception
+> exception SYNTAX_ERROR_2
DROP TABLE TEST /*;
-> exception
+> exception SYNTAX_ERROR_1
DROP TABLE TEST;
> ok
@@ -6541,13 +6541,13 @@ select 1 from test, test where 1 in (select 1 from test where id=1);
> rows: 9
select * from test, test where id=id;
-> exception
+> exception AMBIGUOUS_COLUMN_NAME_1
select 1 from test, test where id=id;
-> exception
+> exception AMBIGUOUS_COLUMN_NAME_1
select 1 from test where id in (select id from test, test);
-> exception
+> exception AMBIGUOUS_COLUMN_NAME_1
DROP TABLE TEST;
> ok
@@ -6656,13 +6656,13 @@ INSERT INTO TEST VALUES(0, '0:0:0','1-2-3','2-3-4 0:0:0');
> update count: 1
INSERT INTO TEST VALUES(1, '01:02:03','2001-02-03','2001-02-29 0:0:0');
-> exception
+> exception INVALID_DATETIME_CONSTANT_2
INSERT INTO TEST VALUES(1, '24:62:03','2001-02-03','2001-02-01 0:0:0');
-> exception
+> exception INVALID_DATETIME_CONSTANT_2
INSERT INTO TEST VALUES(1, '23:02:03','2001-04-31','2001-02-01 0:0:0');
-> exception
+> exception INVALID_DATETIME_CONSTANT_2
INSERT INTO TEST VALUES(1,'1:2:3','4-5-6','7-8-9 0:1:2');
> update count: 1
@@ -6937,25 +6937,25 @@ SELECT 2/3 FROM TEST WHERE ID=1;
> rows: 1
SELECT ID/ID FROM TEST;
-> exception
+> exception DIVISION_BY_ZERO_1
SELECT XT/XT FROM TEST;
-> exception
+> exception DIVISION_BY_ZERO_1
SELECT X_SM/X_SM FROM TEST;
-> exception
+> exception DIVISION_BY_ZERO_1
SELECT XB/XB FROM TEST;
-> exception
+> exception DIVISION_BY_ZERO_1
SELECT XD/XD FROM TEST;
-> exception
+> exception DIVISION_BY_ZERO_1
SELECT XD2/XD2 FROM TEST;
-> exception
+> exception DIVISION_BY_ZERO_1
SELECT XR/XR FROM TEST;
-> exception
+> exception DIVISION_BY_ZERO_1
SELECT ID++0, -X1, -XT, -X_SM, -XB, -XD, -XD2, -XR FROM TEST;
> ID + 0 - X1 - XT - X_SM - XB - XD - XD2 - XR
@@ -7396,9 +7396,7 @@ DROP TABLE TEST;
--- help ----------------------------------------------------------------------------------------------
HELP ABCDE EF_GH;
-> ID SECTION TOPIC SYNTAX TEXT
-> -- ------- ----- ------ ----
-> rows: 0
+> exception GENERAL_ERROR_1
--- sequence ----------------------------------------------------------------------------------------------
CREATE CACHED TABLE TEST(ID INT PRIMARY KEY);
@@ -7623,7 +7621,7 @@ CREATE TABLE TEST(ID INT, CONSTRAINT PK PRIMARY KEY(ID), NAME VARCHAR, PARENT IN
> ok
ALTER TABLE TEST DROP PRIMARY KEY;
-> exception
+> exception INDEX_BELONGS_TO_CONSTRAINT_2
ALTER TABLE TEST DROP CONSTRAINT PK;
> ok
@@ -7638,7 +7636,7 @@ INSERT INTO TEST VALUES(3, 'Karin', 2);
> update count: 1
INSERT INTO TEST VALUES(4, 'Joe', 5);
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
INSERT INTO TEST VALUES(4, 'Joe', 3);
> update count: 1
@@ -7656,7 +7654,7 @@ ALTER TABLE TEST DROP PRIMARY KEY;
> ok
ALTER TABLE TEST DROP PRIMARY KEY;
-> exception
+> exception INDEX_NOT_FOUND_1
ALTER TABLE TEST DROP CONSTRAINT A_UNIQUE;
> ok
@@ -7677,7 +7675,7 @@ ALTER TABLE TEST DROP CONSTRAINT C1;
> ok
ALTER TABLE TEST DROP CONSTRAINT C1;
-> exception
+> exception CONSTRAINT_NOT_FOUND_1
DROP TABLE TEST;
> ok
@@ -7698,16 +7696,16 @@ ALTER TABLE A_TEST ADD CONSTRAINT DATE_UNIQUE_2 UNIQUE(A_DATE);
> ok
INSERT INTO A_TEST VALUES(NULL, NULL, NULL, NULL);
-> exception
+> exception NULL_NOT_ALLOWED
INSERT INTO A_TEST VALUES(1, 'A', NULL, NULL);
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
INSERT INTO A_TEST VALUES(1, 'AB', NULL, NULL);
> update count: 1
INSERT INTO A_TEST VALUES(1, 'AB', NULL, NULL);
-> exception
+> exception DUPLICATE_KEY_1
INSERT INTO A_TEST VALUES(2, 'AB', NULL, NULL);
> update count: 1
@@ -7716,7 +7714,7 @@ INSERT INTO A_TEST VALUES(3, 'AB', '2004-01-01', NULL);
> update count: 1
INSERT INTO A_TEST VALUES(4, 'AB', '2004-01-01', NULL);
-> exception
+> exception DUPLICATE_KEY_1
INSERT INTO A_TEST VALUES(5, 'ABC', '2004-01-02', NULL);
> update count: 1
@@ -7734,10 +7732,10 @@ ALTER TABLE B_TEST ADD PRIMARY KEY(B_INT);
> ok
INSERT INTO B_TEST VALUES(10, 'X');
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
INSERT INTO B_TEST VALUES(1, 'X');
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
INSERT INTO B_TEST VALUES(1, 'XX');
> update count: 1
@@ -7764,7 +7762,7 @@ ALTER TABLE B_TEST ADD CONSTRAINT C2 FOREIGN KEY(B_INT) REFERENCES A_TEST(A_INT)
> ok
UPDATE A_TEST SET A_INT = A_INT*10;
-> exception
+> exception NULL_NOT_ALLOWED
SELECT * FROM B_TEST;
> B_INT B_VARCHAR
@@ -7862,7 +7860,7 @@ INSERT INTO FAMILY VALUES(1, 'Capone');
> update count: 1
INSERT INTO CHILD VALUES(100, 1, 1, 'early');
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
INSERT INTO PARENT VALUES(1, 1, 'Sue');
> update count: 1
@@ -7895,7 +7893,7 @@ SELECT * FROM CHILD;
> rows: 4
UPDATE CHILD SET PARENTID=-1 WHERE PARENTID IS NOT NULL;
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
DELETE FROM PARENT WHERE ID=2;
> update count: 1
@@ -7995,7 +7993,7 @@ INSERT INTO INVOICE_LINE VALUES(1, 100, 10, 'Apples', 20.35), (1, 100, 20, 'Pape
> update count: 4
INSERT INTO INVOICE_LINE VALUES(1, 102, 20, 'Nothing', 30.00);
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
DELETE FROM INVOICE WHERE ID = 100;
> update count: 1
@@ -8277,13 +8275,13 @@ drop table test;
> ok
select 0 from ((
- select 0 as f from dual u1 where null in (?, ?, ?, ?, ?)
+select 0 as f from dual u1 where null in (?, ?, ?, ?, ?)
) union all (
- select u2.f from (
- select 0 as f from (
- select 0 from dual u2f1f1 where now() = ?
- ) u2f1
- ) u2
+select u2.f from (
+select 0 as f from (
+select 0 from dual u2f1f1 where now() = ?
+) u2f1
+) u2
)) where f = 12345;
{
11, 22, 33, 44, 55, null
@@ -8303,7 +8301,7 @@ alter table if exists x add column a varchar;
> ok
alter table if exists x add column a varchar;
-> exception
+> exception DUPLICATE_COLUMN_NAME_1
alter table if exists y alter column a rename to b;
> ok
@@ -8312,7 +8310,7 @@ alter table if exists x alter column a rename to b;
> ok
alter table if exists x alter column a rename to b;
-> exception
+> exception COLUMN_NOT_FOUND_1
alter table if exists y alter column b set default 'a';
> ok
@@ -8345,7 +8343,7 @@ alter table if exists x alter column b set not null;
> ok
insert into x(id) values(1);
-> exception
+> exception NULL_NOT_ALLOWED
alter table if exists y alter column b drop not null;
> ok
@@ -8372,13 +8370,13 @@ alter table if exists x add constraint x_pk primary key (id);
> ok
alter table if exists x add constraint x_pk primary key (id);
-> exception
+> exception CONSTRAINT_ALREADY_EXISTS_1
insert into x(id) values(1);
> update count: 1
insert into x(id) values(1);
-> exception
+> exception DUPLICATE_KEY_1
delete from x;
> update count: 1
@@ -8390,10 +8388,10 @@ alter table if exists x add constraint x_check check (b = 'a');
> ok
alter table if exists x add constraint x_check check (b = 'a');
-> exception
+> exception CONSTRAINT_ALREADY_EXISTS_1
insert into x(id, b) values(1, 'b');
-> exception
+> exception CHECK_CONSTRAINT_VIOLATED_1
alter table if exists y rename constraint x_check to x_check1;
> ok
@@ -8402,7 +8400,7 @@ alter table if exists x rename constraint x_check to x_check1;
> ok
alter table if exists x rename constraint x_check to x_check1;
-> exception
+> exception CONSTRAINT_NOT_FOUND_1
alter table if exists y drop constraint x_check1;
> ok
@@ -8432,13 +8430,13 @@ alter table if exists z add constraint z_uk unique (b);
> ok
alter table if exists z add constraint z_uk unique (b);
-> exception
+> exception CONSTRAINT_ALREADY_EXISTS_1
insert into z(id, b) values(1, 'b');
> update count: 1
insert into z(id, b) values(1, 'b');
-> exception
+> exception DUPLICATE_KEY_1
delete from z;
> update count: 1
@@ -8450,7 +8448,7 @@ alter table if exists z drop column b;
> ok
alter table if exists z drop column b;
-> exception
+> exception COLUMN_NOT_FOUND_1
alter table if exists y drop primary key;
> ok
@@ -8459,7 +8457,7 @@ alter table if exists z drop primary key;
> ok
alter table if exists z drop primary key;
-> exception
+> exception INDEX_NOT_FOUND_1
create table x (id int not null primary key);
> ok
@@ -8471,10 +8469,10 @@ alter table if exists z add constraint z_fk foreign key (id) references x (id);
> ok
alter table if exists z add constraint z_fk foreign key (id) references x (id);
-> exception
+> exception CONSTRAINT_ALREADY_EXISTS_1
insert into z (id) values (1);
-> exception
+> exception REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
alter table if exists y drop foreign key z_fk;
> ok
@@ -8483,7 +8481,7 @@ alter table if exists z drop foreign key z_fk;
> ok
alter table if exists z drop foreign key z_fk;
-> exception
+> exception CONSTRAINT_NOT_FOUND_1
insert into z (id) values (1);
> update count: 1
@@ -8530,6 +8528,7 @@ select * from test where year in (select distinct year from test order by year d
> ---- ---------
> 2016 order
> 2016 execution
+> rows (ordered): 2
drop table test;
> ok
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论