diff --git a/ChangeLog b/ChangeLog index 4684dad2b..9e757f4d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #1679440 Added FAQ entry about header errors under IIS caused by an end-of-line character - [gui] avoid displaying a wide selector in server selection +- bug #1614004 [relation] foreign key spanning multiple columns are + incorrectly displayed + [core] added PMA_fatalError() and made use of it . [core] added PMA_isValid() and PMA_ifSetOr() for variable handling . [i18n] use generic $strOptions diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index aae7c97fe..0520dfc1d 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -390,13 +390,16 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') foreach ($analyzed_sql[0]['foreign_keys'] AS $one_key) { - // the analyzer may return more than one column name in the - // index list or the ref_index_list - foreach ($one_key['index_list'] AS $i => $field) { + // The analyzer may return more than one column name in the + // index list or the ref_index_list; if this happens, + // the current logic just discards the whole index; having + // more than one index field is currently unsupported (see FAQ 3.6) + if (count($one_key['index_list']) == 1) { + foreach ($one_key['index_list'] AS $i => $field) { - // If a foreign key is defined in the 'internal' source (pmadb) - // and in 'innodb', we won't get it twice if $source='both' - // because we use $field as key + // If a foreign key is defined in the 'internal' source (pmadb) + // and in 'innodb', we won't get it twice if $source='both' + // because we use $field as key // The parser looks for a CONSTRAINT clause just before // the FOREIGN KEY clause. It finds it (as output from @@ -405,22 +408,23 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') // In those cases, the FOREIGN KEY parsing will put numbers // like -1, 0, 1... instead of the constraint number. - if (isset($one_key['constraint'])) { - $foreign[$field]['constraint'] = $one_key['constraint']; - } + if (isset($one_key['constraint'])) { + $foreign[$field]['constraint'] = $one_key['constraint']; + } - if (isset($one_key['ref_db_name'])) { - $foreign[$field]['foreign_db'] = $one_key['ref_db_name']; - } else { - $foreign[$field]['foreign_db'] = $db; - } - $foreign[$field]['foreign_table'] = $one_key['ref_table_name']; - $foreign[$field]['foreign_field'] = $one_key['ref_index_list'][$i]; - if (isset($one_key['on_delete'])) { - $foreign[$field]['on_delete'] = $one_key['on_delete']; - } - if (isset($one_key['on_update'])) { - $foreign[$field]['on_update'] = $one_key['on_update']; + if (isset($one_key['ref_db_name'])) { + $foreign[$field]['foreign_db'] = $one_key['ref_db_name']; + } else { + $foreign[$field]['foreign_db'] = $db; + } + $foreign[$field]['foreign_table'] = $one_key['ref_table_name']; + $foreign[$field]['foreign_field'] = $one_key['ref_index_list'][$i]; + if (isset($one_key['on_delete'])) { + $foreign[$field]['on_delete'] = $one_key['on_delete']; + } + if (isset($one_key['on_update'])) { + $foreign[$field]['on_update'] = $one_key['on_update']; + } } } }