Bug #49054 Changing partition count fails to create correct ALTER TABLE script
Submitted: 24 Nov 2009 18:47 Modified: 17 Feb 2010 11:52
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:5.2 r4753 OS:Windows (XP)
Assigned to: CPU Architecture:Any

[24 Nov 2009 18:47] Todd Farmer
Description:
When an existing table with partitions is altered using WB, and I change the number of partitions from 2 to 4, the result is a SQL file which contains no ALTER TABLE statement:

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;

SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

SET SQL_MODE=@OLD_SQL_MODE;

SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Needless to say, this SQL script succeeds, but it doesn't do what is intended.

How to repeat:
1.  Alter an existing partitioned table (KEY partitioning method).
2.  Try to change the number of partitions.

Suggested fix:
Create correct ALTER TABLE command.
[11 Dec 2009 21:26] Alfredo Kojima
Fixed to allow any numeric value.
[16 Dec 2009 15:23] Johannes Taxacher
this has been fixed, alter code is correctly generated now when changing partition numbers.
will be included in 5.2.11
[16 Dec 2009 15:55] Johannes Taxacher
sorry, my mistake ... in some cases/combinations the live-editor still creates err. code
[30 Dec 2009 18:34] Alfredo Kojima
Please provide an example of a combination that produces bad code.
[16 Feb 2010 14:34] Johannes Taxacher
cannot reproduce err. alter code in 5.2.15 anymore. fixed in current release.
[17 Feb 2010 11:52] Tony Bedford
An entry has been added to the 5.2.15 changelog:

In the SQL Editor, if an attempt was made to change the number of partitions in a table, using Alter Table, the SQL code produced did not contain the necessary ALTER TABLE statement to effect this change.