When trying to import an ODS (OpenDocument Spreadsheet) file with one or more spaces at the end of one or more column names, the import fails because phpMyAdmin tries to create a table with spaces at the end of the names of the columns of the SQL tables.
Steps to reproduce:
1. Create an ODS with (a) spac(es) trailing the/a column name(s), or use the one attached.
2. Go to the Import page for a database.
3. Check the option Column names in first row.
4. Upload the spreadsheet.
Expected result:
The spreadsheet gets imported into the database correctly.
What I see instead:
phpMyAdmin tries to create a table with spaces at the end of column names, resulting in the following error:
Error
SQL-query:
CREATE TABLE IF NOT EXISTS `world`.`Tab 1` (`At the end of this cell is a space ` int(1), `At the end of this cell there is no space` decimal(4,2), `There is no space at the end of this cell either` int(4)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;MySQL reports:
#1166 - Incorrect column name 'At the end of this cell is a space '
I've tested this both with my local phpMyAdmin 4.1.12 and with the version running at demo.phpmyadmin.net, RELEASE_4_2_7_1-2487-g10c0752
.
Fix: https://github.com/phpmyadmin/phpmyadmin/pull/1347