Please
- tell us which phpMyAdmin version you're using
- attach a small export of the structure for the customers table and the one on which you are adding a relation on the screenshot
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am able to reproduce the duplicated column in 'relations view', but due lack of information I can't confirm it is Rokak' issue.
It occurs when a table field has a PRIMARY KEY and UNIQUE index on it.
After selecting the 'destination_table' (in relations view), a ajax query is executed and it contains the duplicated entries.
The source of this issue is function getUniqueColumns() in Table.class.php (line 1424-1447).
To prevent duplicated field names a filter (like the in_array function) can be applied.
In case you apply it on the source you have to test 2 other scenarios. The function is used 2 more times in tbl_relation.lib.php.
I made a quick/cosmetic fix this issue in tbl_relation.lib.php - add after line 619
619 foreach ($table_obj->getUniqueColumns(false, false) as $column) {
+++ if (!in_array($column,$columns))
620 $columns[] = htmlspecialchars($column);
621 }
But better is to solve it at the source.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I found the problem. Actually, I added 2 indexes on id column in customers table.
One is PRIMARY and other is UNIQUE. I have removed UNIQUE from that column.
Thanks for your efforts.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I asked this question on stackoverflow too.
http://stackoverflow.com/questions/25455686/in-mysql-i-can-see-2-ids-in-one-table-while-assigning-index?noredirect=1#comment39721238_25455686
Last edit: Ronak Patel 2014-08-22
Please
- tell us which phpMyAdmin version you're using
- attach a small export of the structure for the customers table and the one on which you are adding a relation on the screenshot
I am able to reproduce the duplicated column in 'relations view', but due lack of information I can't confirm it is Rokak' issue.
It occurs when a table field has a PRIMARY KEY and UNIQUE index on it.
After selecting the 'destination_table' (in relations view), a ajax query is executed and it contains the duplicated entries.
The source of this issue is function getUniqueColumns() in Table.class.php (line 1424-1447).
To prevent duplicated field names a filter (like the in_array function) can be applied.
In case you apply it on the source you have to test 2 other scenarios. The function is used 2 more times in tbl_relation.lib.php.
I made a quick/cosmetic fix this issue in tbl_relation.lib.php - add after line 619
But better is to solve it at the source.
Hello,
I found the problem. Actually, I added 2 indexes on
id
column in customers table.One is
PRIMARY
and other isUNIQUE
. I have removedUNIQUE
from that column.Thanks for your efforts.
Thanks Alexander for the hint and Ronak for the feedback. Fix:
https://github.com/phpmyadmin/phpmyadmin/commit/ac7a6cee32997b2f5d505a3a6f210543564ffd9f