bug #1831646 [table creation] Error in CREATE TABLE with multiple primary keys and AUTO_INCREMENT
This commit is contained in:
@@ -20,7 +20,9 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
|
|||||||
- bug #1823045 [import] Error importing file with lowercase "delimiter"
|
- bug #1823045 [import] Error importing file with lowercase "delimiter"
|
||||||
- bug #1828913 [structure] Can't set FULLTEXT index on CHAR column
|
- bug #1828913 [structure] Can't set FULLTEXT index on CHAR column
|
||||||
- bug #1804081 [export] export on server doesn't obey AllowAnyWhereRecoding
|
- bug #1804081 [export] export on server doesn't obey AllowAnyWhereRecoding
|
||||||
- bug #178988 [display] space before SHOW COLUMNS
|
- bug #1789988 [display] space before SHOW COLUMNS
|
||||||
|
- bug #1831646 [table creation] Error in CREATE TABLE with multiple primary
|
||||||
|
keys and AUTO_INCREMENT
|
||||||
|
|
||||||
2.11.2.1 (2007-11-11)
|
2.11.2.1 (2007-11-11)
|
||||||
- fixed possible SQL injection using database name
|
- fixed possible SQL injection using database name
|
||||||
|
@@ -343,16 +343,22 @@ class PMA_Table {
|
|||||||
|
|
||||||
if (!empty($extra)) {
|
if (!empty($extra)) {
|
||||||
$query .= ' ' . $extra;
|
$query .= ' ' . $extra;
|
||||||
// An auto_increment field must be use as a primary key
|
// Force an auto_increment field to be part of the primary key
|
||||||
if ($extra == 'AUTO_INCREMENT' && isset($field_primary)) {
|
// 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);
|
$primary_cnt = count($field_primary);
|
||||||
for ($j = 0; $j < $primary_cnt && $field_primary[$j] != $index; $j++) {
|
$found_in_pk = false;
|
||||||
// void
|
for ($j = 0; $j < $primary_cnt; $j++) {
|
||||||
|
if ($field_primary[$j] == $index) {
|
||||||
|
$found_in_pk = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} // end for
|
} // end for
|
||||||
if (isset($field_primary[$j]) && $field_primary[$j] == $index) {
|
if (! $found_in_pk) {
|
||||||
$query .= ' PRIMARY KEY';
|
$field_primary[] = $index;
|
||||||
unset($field_primary[$j]);
|
}
|
||||||
} // end if
|
|
||||||
} // end if (auto_increment)
|
} // end if (auto_increment)
|
||||||
}
|
}
|
||||||
if (PMA_MYSQL_INT_VERSION >= 40100 && !empty($comment)) {
|
if (PMA_MYSQL_INT_VERSION >= 40100 && !empty($comment)) {
|
||||||
|
Reference in New Issue
Block a user