Bug #82666 Wrong table partition syntax generated
Submitted: 20 Aug 2016 11:00 Modified: 25 Aug 2016 6:46
Reporter: Kit Yam Tse (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.3.7 OS:MacOS
Assigned to: CPU Architecture:Any

[20 Aug 2016 11:00] Kit Yam Tse
Description:
Values in column "Data Directory" and "Index Directory" at table creator are set to "Max Rows" and "Min Rows" in SQL, and vice versa, in OS X version.

How to repeat:
1. open create table form 
2. add one field named `idnew_table`
3. go to partition tab
4. enable partition
5. change partition method to `RANGE`
6. set `idnew_table` as parameter
6. enable manually define a partition
7. add a row with the following properties
  - Values: 
    MAXVALUE
  - Data Directory: /tmp/data
  - Index Directory: /tmp/index
  - Min Rows: 0
  - Max Rows: 100
8. click apply and you will get a wrong SQL

Actual(Wrong):
```
CREATE TABLE `test`.`new_table` (
) PARTITION BY RANGE(idnew_table) PARTITIONS 1( PARTITION part0 VALUES LESS THAN (MAXVALUES) DATA DIRECTORY = '0' INDEX DIRECTORY = '100' MAX_ROWS = /tmp/index MIN_ROWS = /tmp/data) ;
```

Expected(Correct):
```
CREATE TABLE `test`.`new_table` (
) PARTITION BY RANGE(idnew_table) PARTITIONS 1( PARTITION part0 VALUES LESS THAN (MAXVALUES) DATA DIRECTORY = '/tmp/data' INDEX DIRECTORY = '/tmp/data' MAX_ROWS = 100 MIN_ROWS = 0) ;
```

Suggested fix:
Update column identifier in xib

We are assigning value of column with identifier X to the X-th column enum defined in table partition model, however, the identifier doesn't match the defined enum
e.g. column `MAX ROWS` has identifier 5 but the MaxRows are the 2nd column enum defined in the model.
[20 Aug 2016 11:04] Kit Yam Tse
A screenshot shows partition table setting used to repeat the bug

Attachment: Screen Shot 2016-08-20 at 6.27.35 PM.png (image/png, text), 111.81 KiB.

[25 Aug 2016 6:44] MySQL Verification Team
Hello Kit Yam Tse,

Thank you for the report and repeatable steps.
Verified as described with MySQL Workbench Community (GPL) for Mac OS X version 6.3.7 CE build 1199 (64 bit) on OS X 10.11.x El Capitan.

-- OS X

CREATE TABLE IF NOT EXISTS `mydb`.`table1` (
  `idnew_table` INT NOT NULL,
  PRIMARY KEY (`idnew_table`))
ENGINE = InnoDB PARTITION BY RANGE(idnew_table) PARTITIONS 1( PARTITION part0 VALUES LESS THAN (MAXVALUES) DATA DIRECTORY = '0' INDEX DIRECTORY = '100' MAX_ROWS = /tmp/index MIN_ROWS = /tmp/data) 

Interestingly, also as mentioned in the report - this seems to be OS X only issue and I  didn't notice any issues on Win7.

Thanks,
Umesh
[25 Aug 2016 6:46] MySQL Verification Team
I see you have provided patch in Bug #82716 for this issue, lets mark this as duplicate of Bug #82716 and continue with Bug #82716.

Thanks,
Umesh
[25 Aug 2016 6:47] MySQL Verification Team
Screenshot

Attachment: Screen Shot 2016-08-25 at 12.12.41 PM.png (image/png, text), 42.47 KiB.