EVOLUTION-MANAGER
Edit File: allow_no_primary_key.test
--source include/have_rocksdb.inc # # This test checks some very basic capabilities # for tables without primary keys. A hidden pk will be generated under the hood # in myrocks. 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=rocksdb; --source no_primary_key_basic_ops.inc DROP TABLE t1; ## test ALTER CREATE TABLE t1 (a INT, c CHAR(8)) ENGINE=rocksdb; 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=rocksdb; 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=rocksdb; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); CREATE TABLE t2 (a INT, b CHAR(8)) ENGINE=rocksdb; 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=rocksdb; 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=rocksdb; 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; --echo # --echo # Issue #834/MDEV-15304 ALTER TABLE table_with_hidden_pk causes Can't --echo # write; duplicate key in table error and/or crash --echo # CREATE TABLE t1 (a INT, KEY(a)) ENGINE=RocksDB; INSERT INTO t1 VALUES (1),(1+1); create table t2 (a int); insert into t2 values (10),(20),(30); BEGIN; select * from t2; connect (con1,localhost,root,,); connection con1; alter table t1 force; connection default; select * from t1; connection con1; insert into t1 values (100); select * from t1; disconnect con1; connection default; rollback; drop table t1,t2;