*** Bug #33404 ***
SET @@storage_engine = 'Falcon';
DROP TABLESPACE ts1 Engine 'Falcon';
DROP TABLESPACE ts2 Engine 'Falcon';
DROP TABLESPACE ts3 Engine 'Falcon';
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' Engine 'Falcon';
CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.fts' Engine 'Falcon';
CREATE TABLESPACE ts3 ADD DATAFILE 'ts3.fts' Engine 'Falcon';
CREATE TABLE t1 (a INT) TABLESPACE ts1
PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (
PARTITION p1 VALUES LESS THAN (100) TABLESPACE ts2 (
SUBPARTITION p1s1 TABLESPACE ts3,
SUBPARTITION p1s2
),
PARTITION p2 VALUES LESS THAN MAXVALUE (
SUBPARTITION p2s1,
SUBPARTITION p2s2
)
);
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p1 VALUES LESS THAN (100)
 (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon,
  SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon),
 PARTITION p2 VALUES LESS THAN MAXVALUE
 (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon,
  SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon)) */
ALTER TABLE t1 REMOVE PARTITIONING;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1
ALTER TABLE t1 TABLESPACE ts1
PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (
PARTITION p1 VALUES LESS THAN (100) TABLESPACE ts2 (
SUBPARTITION p1s1 TABLESPACE ts3,
SUBPARTITION p1s2
),
PARTITION p2 VALUES LESS THAN (200) (
SUBPARTITION p2s1,
SUBPARTITION p2s2
)
);
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p1 VALUES LESS THAN (100)
 (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon,
  SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon),
 PARTITION p2 VALUES LESS THAN (200)
 (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon,
  SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon)) */
ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN MAXVALUE);
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p1 VALUES LESS THAN (100)
 (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon,
  SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon),
 PARTITION p2 VALUES LESS THAN (200)
 (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon,
  SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon),
 PARTITION p3 VALUES LESS THAN MAXVALUE
 (SUBPARTITION p3sp0 TABLESPACE = ts1 ENGINE = Falcon,
  SUBPARTITION p3sp1 TABLESPACE = ts1 ENGINE = Falcon)) */
ALTER TABLE t1 REORGANIZE PARTITION p3 INTO (PARTITION p3 VALUES LESS THAN
MAXVALUE TABLESPACE ts1);
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p1 VALUES LESS THAN (100)
 (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon,
  SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon),
 PARTITION p2 VALUES LESS THAN (200)
 (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon,
  SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon),
 PARTITION p3 VALUES LESS THAN MAXVALUE
 (SUBPARTITION p3sp0 TABLESPACE = ts1 ENGINE = Falcon,
  SUBPARTITION p3sp1 TABLESPACE = ts1 ENGINE = Falcon)) */
ALTER TABLE t1 REORGANIZE PARTITION p3 INTO (PARTITION p3 VALUES LESS THAN
MAXVALUE TABLESPACE ts2);
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p1 VALUES LESS THAN (100)
 (SUBPARTITION p1s1 TABLESPACE = ts3 ENGINE = Falcon,
  SUBPARTITION p1s2 TABLESPACE = ts2 ENGINE = Falcon),
 PARTITION p2 VALUES LESS THAN (200)
 (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon,
  SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon),
 PARTITION p3 VALUES LESS THAN MAXVALUE
 (SUBPARTITION p3sp0 TABLESPACE = ts2 ENGINE = Falcon,
  SUBPARTITION p3sp1 TABLESPACE = ts2 ENGINE = Falcon)) */
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO (PARTITION p1 VALUES LESS THAN
(100) TABLESPACE ts2);
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION p1 VALUES LESS THAN (100)
 (SUBPARTITION p1sp0 TABLESPACE = ts2 ENGINE = Falcon,
  SUBPARTITION p1sp1 TABLESPACE = ts2 ENGINE = Falcon),
 PARTITION p2 VALUES LESS THAN (200)
 (SUBPARTITION p2s1 TABLESPACE = ts1 ENGINE = Falcon,
  SUBPARTITION p2s2 TABLESPACE = ts1 ENGINE = Falcon),
 PARTITION p3 VALUES LESS THAN MAXVALUE
 (SUBPARTITION p3sp0 TABLESPACE = ts2 ENGINE = Falcon,
  SUBPARTITION p3sp1 TABLESPACE = ts2 ENGINE = Falcon)) */
SELECT count(*) FROM t1;
count(*)
0
DROP TABLE t1;
DROP TABLESPACE ts1 Engine 'Falcon';
DROP TABLESPACE ts2 Engine 'Falcon';
DROP TABLESPACE ts3 Engine 'Falcon';
