Bug #17882 Failed to find some pk columns.
Submitted: 3 Mar 2006 1:12 Modified: 29 Jan 2018 11:03
Reporter: Yonghong Zhao Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Migration Toolkit Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[3 Mar 2006 1:12] Yonghong Zhao
Description:
Line from 389-398 in MigrationGeneric.java of 2.1rc:
					if (targetTable.getPrimaryKey() != null) {
						// and the current column is not part of the PK
						if (!targetTable.getPrimaryKey().getColumns().contains(
								col)) {
							// reset AutoInc
							col.setAutoIncrement(0);
						} else {
							autoIncCount = 1;
						}
					}

How to repeat:
Found in Dec 10th, 2005.

targetTable.getPrimaryKey().getColumns().contains(col)

is lame.

Suggested fix:
should be:
					if (targetTable.getPrimaryKey() != null) {
						// and the current column is not part of the PK
                                                int j=0;
                                                for(;j<targetTable.getPrimaryKey().getColumns().size();j++){
                                                  if(targetTable.getPrimaryKey().getColumns().get(j).getReferedColumn().equals(col)){
                                                    // reset AutoInc
                                                    break;
                                                  }
                                                }
                                                //buggy....
                                                if(j==targetTable.getPrimaryKey().getColumns().size()){
//						if (!targetTable.getPrimaryKey().getColumns().contains(col)) {
							// reset AutoInc
							col.setAutoIncrement(0);
						} else {
							autoIncCount = 1;
						}
					}
[2 May 2006 18:48] Jorge del Conde
Thanks for your code mod.
[5 May 2009 6:23] Susanne Ebrecht
Many thanks for sending us a patch.

We will look if we can implement it.
[29 Jan 2018 11:03] Mike Lischke
Issue has been reported for a product that no longer exists.