99 lines
2.7 KiB
Plaintext
99 lines
2.7 KiB
Plaintext
--source suite/xengine/include/have_xengine.inc
|
|
|
|
#
|
|
# This test checks some very basic capabilities
|
|
# for tables without primary keys. A hidden pk will be generated under the hood
|
|
# in myx. Everything should work here as normal.
|
|
#
|
|
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1;
|
|
--enable_warnings
|
|
|
|
# test CREATE
|
|
CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=xengine;
|
|
--source no_primary_key_basic_ops.inc
|
|
DROP TABLE t1;
|
|
|
|
## test ALTER
|
|
CREATE TABLE t1 (a INT, c CHAR(8)) ENGINE=xengine;
|
|
INSERT INTO t1 VALUES (1,'a'),(5,'z');
|
|
ALTER TABLE t1 ADD COLUMN b INT;
|
|
SHOW CREATE TABLE t1;
|
|
|
|
--sorted_result
|
|
SELECT * FROM t1;
|
|
ALTER TABLE t1 DROP COLUMN b;
|
|
SHOW CREATE TABLE t1;
|
|
--sorted_result
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
## test creating a table with primary and then dropping that key
|
|
CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=xengine;
|
|
ALTER TABLE t1 DROP COLUMN pk;
|
|
--source no_primary_key_basic_ops.inc
|
|
DROP TABLE t1;
|
|
|
|
# test CHECK TABLE
|
|
# CHECK TABLE statements
|
|
#
|
|
# Note: the output is likely to be different for the engine under test,
|
|
# in which case rdiff will be needed. Or, the output might say that
|
|
# the storage engine does not support CHECK.
|
|
#
|
|
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1,t2;
|
|
--enable_warnings
|
|
|
|
CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=xengine;
|
|
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
|
|
|
|
CREATE TABLE t2 (a INT, b CHAR(8)) ENGINE=xengine;
|
|
|
|
CHECK TABLE t1;
|
|
INSERT INTO t1 (a,b) VALUES (3,'c');
|
|
INSERT INTO t2 (a,b) VALUES (4,'d');
|
|
CHECK TABLE t1, t2 FOR UPGRADE;
|
|
INSERT INTO t2 (a,b) VALUES (5,'e');
|
|
CHECK TABLE t2 QUICK;
|
|
INSERT INTO t1 (a,b) VALUES (6,'f');
|
|
CHECK TABLE t1 FAST;
|
|
INSERT INTO t1 (a,b) VALUES (7,'g');
|
|
INSERT INTO t2 (a,b) VALUES (8,'h');
|
|
CHECK TABLE t2, t1 MEDIUM;
|
|
INSERT INTO t1 (a,b) VALUES (9,'i');
|
|
INSERT INTO t2 (a,b) VALUES (10,'j');
|
|
CHECK TABLE t1, t2 EXTENDED;
|
|
INSERT INTO t1 (a,b) VALUES (11,'k');
|
|
CHECK TABLE t1 CHANGED;
|
|
|
|
DROP TABLE t1, t2;
|
|
|
|
# test unique keys with no primary key
|
|
CREATE TABLE t1 (a INT, b CHAR(8), UNIQUE INDEX(a)) ENGINE=XENGINE;
|
|
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
|
|
--error ER_DUP_ENTRY
|
|
INSERT INTO t1 (a,b) VALUES (1,'c');
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t1 WHERE a = 2;
|
|
EXPLAIN SELECT * FROM t1 WHERE a = 2;
|
|
DROP TABLE t1;
|
|
|
|
## test restarting a table that has no data
|
|
CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=xengine;
|
|
SHOW CREATE TABLE t1;
|
|
SHOW COLUMNS IN t1;
|
|
--source include/restart_mysqld.inc
|
|
|
|
## single delete statement should remove MULTIPLE rows (aka duplicate rows)
|
|
INSERT INTO t1 (a,b) VALUES (35,'foo');
|
|
INSERT INTO t1 (a,b) VALUES (35,'foo');
|
|
INSERT INTO t1 (a,b) VALUES (36,'foo');
|
|
DELETE FROM t1 WHERE a = 35 AND b = 'foo';
|
|
--sorted_result
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
--source suite/xengine/include/check_xengine_log_error.inc
|