-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Hello,
when a table name contains upper-case letters PMA doesn't show the form to create foreign key constraints under Stucture > Relation View even if Engine = InnoDB. It works fine when using lower-case table names.
Example were foreign key constraints can be created (form is shown):
CREATE TABLE `fkworks` ( `test` INT NOT NULL ) ENGINE = InnoDB;
Example were foreign key constraints cannot be created (form is hidden):
CREATE TABLE `FKfails` ( `test` INT NOT NULL ) ENGINE = InnoDB;
The reason is that PMA_Util::isForeignKeySupported
only shows the form if $engine == 'INNODB'
, but since the table name contains upper-case letters, $engine
is empty.
Table schematics are stored using a mb_strtolower
ed table name in PMA_DatabaseInterface::$_table_cache
. This variable does contain the correct engine for both test cases.
To get the engine, PMA_Table::getStatusInfo
gets invoked, but uses the original table name for the cache lookup, which fails, since the table schematics are stored lower-cased.
A quick fix that worked for me was to add mb_strtolower
in PMA_Table::getStatusInfo
:
$table = mb_strtolower($this->_name);
This shouldn't cause problems since on the system that has this problem you can't create tables which only differ in case i.e. Test
and test
cannot both exist in the same database.
Possibly related to http://sourceforge.net/p/phpmyadmin/bugs/2036/
Related stackoverflow question: http://stackoverflow.com/q/25616281/1220835
System: confirmed on OS X 10.9 and 10.10.
Apache: 2.4.10
PHP: 5.5.21
MySQL: 5.6.22
PMA: confirmed on 4.3.9 and 4.5.0-beta1 (most current)
lower_case_file_system = ON (default)
lower_case_table_names = 2 (default for OS X meaning tables get stored using their original names, but are compared case-insensitively)