Bug #17754 Partitions: ALTER TABLE ... ENGINE= ... removes partitioning scheme
Submitted: 27 Feb 2006 20:20 Modified: 24 Mar 2006 14:59
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1.8 OS:Linux (Linux)
Assigned to: Mikael Ronström CPU Architecture:Any

[27 Feb 2006 20:20] Jonathan Miller
Description:
Example:

CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t DATE)ENGINE=NDB PARTITION BY HASH( YEAR(t) ) PARTITIONS 4;

ALTER TABLE t1 ENGINE=MyISAM;

t1 after alter has no information on the partition by hash. 

SHOW CREATE TABLE t1;

CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT 0, total BIGINT UNSIGNED, y YEAR, t DATE)ENGINE=MyISAM;

How to repeat:
See above

Suggested fix:
Users should have the ability to keep the data paritioned between storage table transitions
[27 Feb 2006 20:25] Jorge del Conde
Tested w/5.1 from a recent bk pull under fc4
[8 Mar 2006 8:11] Mikael Ronström
Change semantics of ALTER TABLE t1 ENGINE=X; and added
ALTER TABLE t1 REMOVE PARTITIONING;
[20 Mar 2006 22:24] Mikael Ronström
This patch will be available in 5.1.8

The semantics of ALTER TABLE t1 ENGINE=X; is changed for partitioned tables to mean that
ENGINE of the partitions is changed to X.

In order to remove partitioning of a table one has to use the new syntax
ALTER TABLE t1 REMOVE PARTITIONING;
This syntax can be used in combination with other ALTER TABLE syntax to add/drop
fields/indexes/engine ...

Also a few errors for using combinations of engines in ALTER TABLE statement was fixed
[24 Mar 2006 14:59] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented feature change in 5.1.8 changelog; also noted in ALTER TABLE Syntax and Partitioning Management secitons of Manual. Bug closed.