Home » Mysql » Resolution: This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available

Resolution: This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available

Posted by: admin November 1, 2017 Leave a comment

Questions:

This is not a question but a self generated problem/question and solution that I found working. I thought it would be decent courtesy to share since there was not a complete working solution I could find.

The error generated in phpMyAdmin is:

“This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.”

There are several working solutions depending on your exact scenario.

For example, as long as all of your AI or Unique identifier field are unique then you can simply alter the table and ensure this is the Primary key and set to unique value.

I solved this with this solution on one of my tables.

The other table had multiple AI int values that were the Primary field, but there were multiple values of the same kind.

The simple fix for this was to just add a column to the end of the table as Unique AI Int. Basically all MySQL is saying is it needs a unique value in each record to differentiate the rows.

Hope this was helpful.

Answers:

I have been faced this problem.

The cause is your table don’t have a primary key field.

And I have a simple solution: Set a field to primary key to specific filed that suit with your business logic.

For example, I have database thesis_db and field thesis_id, I will press button Primary (key icon) to set thesis_id to become primary key field:

enter image description here

Questions:
Answers:

This is not an error. PhpMyAdmin is just informing you, that there is no unique ID column in your result set. Depending on the type of query you sent, this is the desired behaviour.

It is not MySQL which is saying it needs a unique ID, if any combination of the columns in your result set is unique, the values of those columns can be used in an UPDATE or DELETE query. It is phpMyAdmin which says it does not have enough information to offer you the checkboxes and buttons you will normally see in a result set with unique ID.

Questions:
Answers:

My case is different. This issue is only specific to PHPMyAdmin. I downloaded couple other admin tools (Adminer, MySQLWorkbench, HeidiSQL etc) and the same db works fine in all of those.

I have all the indexes, primary key and unique keys defined and still get the error. I get this after I upgraded to MySQL 5.6 (did not face the same with the previous versions).

Turns out PMA has issues with Table names in capital. PMA is not able to recognise keys with capital table names. Once I change them to small (ALTER TABLE mytable ENGINE=INNODB — I use INNODB — does that for each table without changing anything else), I was able to access normally. I’m on a Windows system with UniformServer.

Questions:
Answers:

Simply create a new column, set the Name to whatever you like, set the Type to INT and check the box that says A_I.

diagram
The A_I checkbox stands for AUTO_INCREMENT, which essentially means that sequence numbers are assigned automatically in that new column (see below).

 column1 | column2 | id
-----------------------
 value   | value   | 1
-----------------------
 value   | value   | 2
-----------------------
 value   | value   | 3
-----------------------
 value   | value   | 4

This column essentially acts as a reference for phpMyAdmin to delete rows from. If necessary, click on the unique button for this new column, although this happened automatically for me. After following the above steps, you should no longer have the error message and buttons should appear for editing rows in phpMyAdmin!

Questions:
Answers:

In my case, the error occured in phpmyadmin version 4.5.1 when i set lower_case_table_names = 2 and had a table name with uppercase characters, The table had a primary key set to auto increment but still showed the error. The issue stopped when i changed the table name to all lowercase.

Questions:
Answers:

I recently got the same problem and after looking for duplicates I was able to fix it just by setting (missing) primary key on the table. Hope this could help

Questions:
Answers:

This question helped me identify the problem of why phpMyAdmin refused me grid-edit-etc. on some tables. I just had forgotten to declare my primary key and was overseeing it in my “Why the hell should this table be different from its neighbours” solution search process…

I just wanted to react on following in OP self-answer:

The other table had multiple AI int values that were the Primary
field, but there were multiple values of the same kind.

The simple fix for this was to just add a column to the end of the
table as Unique AI Int. Basically all MySQL is saying is it needs a
unique value in each record to differentiate the rows.

This was actually my case, but there’s absolutely no need to add any column: if your primary key is the combination of 2 fields (ex. junction table in many to many relationship), then simply declare it as such:
– eiter in phpyAdmin, just enter “2” in “Create an index on [x] columns”, then select your 2 columns
– or ALTER TABLE mytable ADD PRIMARY KEY(mycol1,mycol2)

Questions:
Answers:

I got this error when trying to modify directly after running Query. Turns out, after making a view from that exact same query, I was able to modify the values.

Questions:
Answers:

An easy fix to this would be going to the SQL tab and just simply put in the code

ALTER TABLE `tablename`
ADD PRIMARY KEY (`id`);

Asuming that you have a row named id.

Questions:
Answers:

I faced the same problem whenever i am firing SELECT query with specific columns, though the one of the column is primary in table. I was trying to fetch selective records with selective columns in standard wordpress “posts” table. ID column is already primary and unique..

Just specifying primary/unique column name will not resolve this issue. You have to specify full column name like “posts.id” (tablename.columnname) that tells PMA to select specific column and reveals edit etc..

My PMA is 4.3.8. Let me know if this helps..