| 1 |
-- source include/have_ndb.inc |
| 2 |
|
| 3 |
--disable_warnings |
| 4 |
DROP TABLE IF EXISTS t1,t2; |
| 5 |
drop database if exists mysqltest; |
| 6 |
--enable_warnings |
| 7 |
|
| 8 |
# |
| 9 |
# Table rename tests |
| 10 |
# |
| 11 |
|
| 12 |
# |
| 13 |
# Create a normal table with primary key |
| 14 |
# |
| 15 |
CREATE TABLE t1 ( |
| 16 |
pk1 INT NOT NULL PRIMARY KEY, |
| 17 |
attr1 INT NOT NULL, |
| 18 |
attr2 INT, |
| 19 |
attr3 VARCHAR(10), |
| 20 |
INDEX i1(attr1) |
| 21 |
) ENGINE=ndbcluster; |
| 22 |
|
| 23 |
INSERT INTO t1 VALUES (0,0,0,"zero"),(1,1,1,"one"),(2,2,2,"two"); |
| 24 |
SELECT * FROM t1 WHERE attr1 = 1; |
| 25 |
alter table t1 rename t2; |
| 26 |
SELECT * FROM t2 WHERE attr1 = 1; |
| 27 |
|
| 28 |
# |
| 29 |
# Bug #16021021 ALTER ... RENAME FAILS TO RENAME ON PARTICIPANT MYSQLD |
| 30 |
# |
| 31 |
--error ER_NOT_SUPPORTED_YET |
| 32 |
alter table t2 rename t1, add attr4 int; |
| 33 |
|
| 34 |
create database ndbtest; |
| 35 |
alter table t2 rename ndbtest.t2; |
| 36 |
SELECT * FROM ndbtest.t2 WHERE attr1 = 1; |
| 37 |
|
| 38 |
drop table ndbtest.t2; |
| 39 |
|
| 40 |
create table t1 ( |
| 41 |
pk1 INT NOT NULL PRIMARY KEY, |
| 42 |
b blob |
| 43 |
) engine = ndbcluster; |
| 44 |
|
| 45 |
alter table t1 rename ndbtest.t1; |
| 46 |
alter table ndbtest.t1 rename test.t1; |
| 47 |
|
| 48 |
drop table test.t1; |
| 49 |
|
| 50 |
drop database ndbtest; |
| 51 |
|
| 52 |
# End of 4.1 tests |