提交 fe655e2b authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Extract TRUNCATE TABLE tests into own script

上级 c6c72d96
......@@ -117,7 +117,7 @@ public class TestScript extends TestBase {
}
for (String s : new String[] { "alterTableAdd", "alterTableDropColumn",
"createAlias", "createSynonym", "createView", "createTable", "createTrigger",
"dropSchema" }) {
"dropSchema", "truncateTable" }) {
testScript("ddl/" + s + ".sql");
}
for (String s : new String[] { "error_reporting", "insertIgnore",
......
-- 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 table FOO(id integer primary key);
> ok
create table BAR(fooId integer);
> ok
alter table bar add foreign key (fooId) references foo (id);
> ok
truncate table bar;
> ok
truncate table foo;
> exception CANNOT_TRUNCATE_1
drop table bar, foo;
> ok
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
> ok
INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World');
> update count: 2
TRUNCATE TABLE TEST;
> ok
SELECT * FROM TEST;
> ID NAME
> -- ----
> rows: 0
DROP TABLE TEST;
> ok
CREATE TABLE PARENT(ID INT PRIMARY KEY, NAME VARCHAR);
> ok
CREATE TABLE CHILD(PARENTID INT, FOREIGN KEY(PARENTID) REFERENCES PARENT(ID), NAME VARCHAR);
> ok
TRUNCATE TABLE CHILD;
> ok
TRUNCATE TABLE PARENT;
> exception CANNOT_TRUNCATE_1
DROP TABLE CHILD;
> ok
DROP TABLE PARENT;
> ok
......@@ -2161,24 +2161,6 @@ drop all objects;
call abc;
> exception COLUMN_NOT_FOUND_1
create table FOO(id integer primary key);
> ok
create table BAR(fooId integer);
> ok
alter table bar add foreign key (fooId) references foo (id);
> ok
truncate table bar;
> ok
truncate table foo;
> exception CANNOT_TRUNCATE_1
drop table bar, foo;
> ok
CREATE TABLE test (family_name VARCHAR_IGNORECASE(63) NOT NULL);
> ok
......@@ -4265,42 +4247,6 @@ SELECT "ROWNUM", ROWNUM, "SELECT" "AS", "PRIMARY" AS "X", "KEY", "NEXTVAL", "IND
DROP TABLE "CREATE";
> ok
--- truncate table ---------------------------------------------------------------------------------------------
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
> ok
INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World');
> update count: 2
TRUNCATE TABLE TEST;
> ok
SELECT * FROM TEST;
> ID NAME
> -- ----
> rows: 0
DROP TABLE TEST;
> ok
CREATE TABLE PARENT(ID INT PRIMARY KEY, NAME VARCHAR);
> ok
CREATE TABLE CHILD(PARENTID INT, FOREIGN KEY(PARENTID) REFERENCES PARENT(ID), NAME VARCHAR);
> ok
TRUNCATE TABLE CHILD;
> ok
TRUNCATE TABLE PARENT;
> exception CANNOT_TRUNCATE_1
DROP TABLE CHILD;
> ok
DROP TABLE PARENT;
> ok
--- test case for number like string ---------------------------------------------------------------------------------------------
CREATE TABLE test (one bigint primary key, two bigint, three bigint);
> ok
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论