Skip to content

Commit

Permalink
Merge pull request #11662 from devenbansod/fix_11661
Browse files Browse the repository at this point in the history
Fix #11661 : Error changing table column's encoding (collation)
  • Loading branch information
devenbansod committed Nov 12, 2015
2 parents 34f310c + 99be092 commit ab5de22
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libraries/controllers/TableStructureController.class.php
Expand Up @@ -696,13 +696,21 @@ protected function updateColumns()
PMA_previewSQL(count($changes) > 0 ? $sql_query : '');
}

$columns_with_index = $this->dbi
->getTable($this->db, $this->table)
->getColumnsWithIndex(
PMA_Index::PRIMARY | PMA_Index::UNIQUE | PMA_Index::INDEX
| PMA_Index::SPATIAL | PMA_Index::FULLTEXT
);

$changedToBlob = array();
// While changing the Column Collation
// First change to BLOB
for ($i = 0; $i < $field_cnt; $i++ ) {
if (isset($_REQUEST['field_collation'][$i])
&& isset($_REQUEST['field_collation_orig'][$i])
&& $_REQUEST['field_collation'][$i] !== $_REQUEST['field_collation_orig'][$i]
&& ! in_array($_REQUEST['field_orig'][$i], $columns_with_index)
) {
$secondary_query = 'ALTER TABLE ' . PMA_Util::backquote(
$this->table
Expand Down

0 comments on commit ab5de22

Please sign in to comment.