bug #1908719 [interface] New field cannot be auto-increment and primary key
This commit is contained in:
@@ -51,6 +51,9 @@ danbarry
|
||||
+ [engines] MyISAM and InnoDB: support ROW_FORMAT table option
|
||||
+ prevent search indexes from indexing phpMyAdmin installations
|
||||
|
||||
2.11.7.0 (not yet released)
|
||||
- bug #1908719 [interface] New field cannot be auto-increment and primary key
|
||||
|
||||
2.11.6.0 (not yet released)
|
||||
- bug #1903724 [interface] Displaying of very large queries in error message
|
||||
- bug #1905711 [compatibility] Functions deprecated in PHP 5.3: is_a() and
|
||||
|
@@ -333,19 +333,29 @@ class PMA_Table {
|
||||
$query .= ' ' . $extra;
|
||||
// Force an auto_increment field to be part of the primary key
|
||||
// even if user did not tick the PK box;
|
||||
// but the PK could contain other columns so do not append
|
||||
// a PRIMARY KEY clause, just add a member to $field_primary
|
||||
if ($extra == 'AUTO_INCREMENT') {
|
||||
$primary_cnt = count($field_primary);
|
||||
$found_in_pk = false;
|
||||
for ($j = 0; $j < $primary_cnt; $j++) {
|
||||
if ($field_primary[$j] == $index) {
|
||||
$found_in_pk = true;
|
||||
break;
|
||||
if (1 == $primary_cnt) {
|
||||
for ($j = 0; $j < $primary_cnt && $field_primary[$j] != $index; $j++) {
|
||||
//void
|
||||
}
|
||||
if (isset($field_primary[$j]) && $field_primary[$j] == $index) {
|
||||
$query .= ' PRIMARY KEY';
|
||||
unset($field_primary[$j]);
|
||||
}
|
||||
// but the PK could contain other columns so do not append
|
||||
// a PRIMARY KEY clause, just add a member to $field_primary
|
||||
} else {
|
||||
$found_in_pk = false;
|
||||
for ($j = 0; $j < $primary_cnt; $j++) {
|
||||
if ($field_primary[$j] == $index) {
|
||||
$found_in_pk = true;
|
||||
break;
|
||||
}
|
||||
} // end for
|
||||
if (! $found_in_pk) {
|
||||
$field_primary[] = $index;
|
||||
}
|
||||
} // end for
|
||||
if (! $found_in_pk) {
|
||||
$field_primary[] = $index;
|
||||
}
|
||||
} // end if (auto_increment)
|
||||
}
|
||||
|
Reference in New Issue
Block a user