Bug #62893 table data is not editable because there is no primary key defined for the table
Submitted: 23 Oct 2011 13:39 Modified: 2 Aug 2012 4:22
Reporter: Danny Zhong Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S1 (Critical)
Version:5.2.41 OS:Linux (Ubuntu 12.04)
Assigned to: CPU Architecture:Any
Tags: edit table data primary key

[23 Oct 2011 13:39] Danny Zhong
Description:
Can't edit table data even if the table has a primary key.

table:
CREATE TABLE `testtable` (
  `id` int(11) NOT NULL,
  `usr` varchar(256) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

MySql Workbench built with the patch http://bugs.mysql.com/file.php?id=17639.

How to repeat:
1. click the table 'testtable' using mouse right button
2. select the menu item "Edit Table Data" from the popup menu
3. check the sql editor output:
   Action: select * from `test`.`testtable` LIMIT 0, 1000
   Message: Error: `test`.`testtable`: table data is not editable because there is no primary key defined for the table
[23 Oct 2011 13:44] Danny Zhong
the operation result

Attachment: Screenshot at 2011-10-23 21:41:29.png (image/png, text), 134.52 KiB.

[24 Oct 2011 3:24] Valeriy Kravchuk
What exact server version, 5.x.y, are you working with?
[24 Oct 2011 4:36] Danny Zhong
The MySql server version is 5.1.42 .

mysqld --version:
/opt/mysql-5.1.41/libexec/mysqld  Ver 5.1.41-log for unknown-linux-gnu on x86_64 (Source distribution)

configuration:
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
-fno-exceptions -fno-rtti" \
./configure --prefix=/opt/mysql-5.1.45 --with-charset=utf8 --with-extra-charsets=all --enable-assembler \
--with-plugins=all \
--enable-thread-safe-client

BTW: the function "Alter Table" works fine.
[24 Oct 2011 4:36] Danny Zhong
Alter Table

Attachment: Screenshot at 2011-10-24 12:30:17.png (image/png, text), 77.42 KiB.

[5 Dec 2011 8:55] Valeriy Kravchuk
Please, check if the same problem still happens with a newer version, 5.2.36.
[6 Dec 2011 13:49] Danny Zhong
I tested again using the newer version 5.2.36, the bug still exist.

Error ouput:

0	21:45:39	SELECT * FROM test.testtable LIMIT 0, 1000	Error: `test`.`testtable`: table data is not editable because there is no primary key defined for the table
[6 Dec 2011 14:05] Danny Zhong
I run the workbench with --log-level option which assigned with 'debug3', but where can I get the debug logging? I want to upload the debug logging.
[9 Dec 2011 11:37] Carlos Ferreira
I have same bug/problem... In previous version this bug doesn't exist...
[9 Dec 2011 13:06] Mike Lischke
Danny, see Help -> System Info, which prints the location of the data folder. In this folder is a logs subfolder.
[9 Dec 2011 13:38] Mike Lischke
Actually, there is even a "Locate Log File" menu entry in the Help menu.
[10 Dec 2011 15:05] Danny Zhong
Thanks everybody. I launched  the workbench using "mysql-workbench --log-level=debug3" and got the log file.

Attachment: wb.log (text/x-log), 1.92 KiB.

[21 Dec 2011 7:47] Stef Heyenrath
The bug is also present in the Windows version from MySQL Workbench. (Tested on Windows XP)
[26 Dec 2011 20:41] MySQL Verification Team
Not repeatable on Windows 7 64-bits.
[27 Dec 2011 15:10] Armando Lopez Valencia
Hello Danny.
A new WB version is out(5.2.37), would you mind give it a try and let us know the outcome?
http://dev.mysql.com/downloads/workbench/
Thanks.
[28 Dec 2011 2:41] Danny Zhong
the bug still exist in version 5.2.37.

Test Result:
0	10:38:49	SELECT * FROM test.testtable LIMIT 0, 1000	Error: `test`.`testtable`: table data is not editable because there is no primary key defined for the table

logging(wb.log):
10:38:14 [   Info][      WBContext]: WbContext::init
10:38:21 [   Info][      WBContext]: System info:
 	MySQL Workbench CE for Linux/Unix version 5.2.37  revision 8576
	Configuration Directory: /home/hdzhong/.mysql/workbench
	Data Directory: /usr/share/mysql-workbench
	Cairo Version: 1.10.2
	Rendering Mode: OpenGL is not available on this system, so Native is used for rendering.
	OS: Linux 3.0.0-14-generic
	CPU: 2x Intel(R) Core(TM)2 Duo CPU     P8400  @ 2.26GHz 2267.000 MHz, 3.8 GB RAM
10:38:21 [   Info][         (null)]: query.save_edits built-in command is being overwritten
10:38:21 [   Info][         (null)]: query.discard_edits built-in command is being overwritten
10:38:41 [   Info][     SSH tunnel]: Starting tunnel
[5 Jan 2012 20:03] Rich Sutton
I am also experiencing this bug in 5.2.37.  In my case, the table I'm querying has a composite primary key.  Interestingly, any select statement that includes al of the columns in the primary key (including a select *) gets this error, but a query that excludes columns in the key succeeds.

Is there an ETA on a fix?
[11 Jan 2012 19:27] Alfredo Kojima
Is testtable exactly the table that is not working for you? Does the error happen only with specific
tables or any tables?
[26 Jan 2012 20:57] Erik Peterson
I see this all the time with 5.2.37 on Windows 7 64 bit.  Is there a workaround to disable editing so I can at least select from a table?

I can select if I specify columns, but select * doesn't work.

BTW, .37 hangs and crashes a couple times a day.  I'd open a ticket, but I have not idea how to reproduce the behavior.  It just happens from time to time.
[27 Jan 2012 16:28] Alfredo Kojima
You can workaround by specifying a function in the column list, like
SELECT *, concat('','') FROM table
[31 Jan 2012 12:53] Rory Michaelis
Alfredo: Thanks so much for the workaround! This bug was driving me nuts (on a table I had no permission or intention of ever editing).

Erik: Yes 5.2.37 really SUCKS also on my WinXP Pro 32b, so I doubt your Win7 64b is the problem. The many information tabs are now so bulky & static - worse than the version a few months ago and much worse than the (SPEEDY!) Query Browser from 3+ years ago...

On a positive note I just read the release notes to unreleased 5.2.38:
( http://dev.mysql.com/doc/workbench/en/wb-news-5-2-38.html )
and the devs knocked off a truly annoying long time bug where grouping WITH ROLLUP would give both an editor & execution error though it is valid MySQL code. Perhaps our current Bug #62893 will be added next...
[6 Feb 2012 22:17] Jeremy Wiedemann
As of right now, I have to add some silly function to my select statement for every select * query I use!  This is a most efficiency killing bug for me!  Nearly enough to make me quit using this product.
[16 Feb 2012 2:08] Stanley Lee
Just wanted to note that I'm experiencing the same issue with a Windows 7 x64 installation of MySQL Workbench.

The work-around works like a charm - though a bit annoying.

- Stan
[21 Feb 2012 10:22] Nick Levett
I can reproduce this problem on 5.2.37 on Mac OS X 10.7.3. Can also confirm the workaround from Alfredo works.
[21 Feb 2012 17:13] Jeremy Wiedemann
I used Alfredo's workaround but found one with less typing. :)

SELECT *,'' FROM <tablename>
[28 Feb 2012 18:40] Armando Lopez Valencia
Hello Danny.
This bug has been fixed in WB 5.2.38.
Can you please give a try and confirm this?
Thanks.
[28 Feb 2012 19:13] Jeremy Wiedemann
Fixed! Thanks!
[28 Feb 2012 19:40] Stanley Lee
Looks to be fixed for me as well. Thanks!
[29 Feb 2012 6:57] Danny Zhong
The bug still exist.

Something enhance: the table object info is display(I will upload a screenshot).

WB log:
14:48:51 [INF][      WBContext]: WbContext::init
14:48:52 [INF][      WBContext]: System info:
 	MySQL Workbench CE for Linux/Unix version 5.2.38  revision 8753
	Configuration Directory: /home/hdzhong/.mysql/workbench
	Data Directory: /usr/share/mysql-workbench
	Cairo Version: 1.10.2
	OS: Linux 3.0.0-16-generic
	CPU: 2x Intel(R) Core(TM)2 Duo CPU     P8400  @ 2.26GHz 2267.000 MHz, 3.8 GB RAM
14:48:54 [INF][     SSH tunnel]: Starting tunnel
[29 Feb 2012 7:03] Danny Zhong
Bug and enhance

Attachment: MySQL Workbench_005.png (image/png, text), 105.83 KiB.

[6 Mar 2012 21:35] Murray Cairns
Updating to 5.2.38 appears to have fixed it for me on Windows Vista SP2.
[24 Apr 2012 23:02] MySQL Verification Team
Please try version 5.2.39. Thanks.
[25 May 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[2 Aug 2012 4:22] Danny Zhong
Bug fixed.

Downloaded the DEB install package from http://dev.mysql.com/downloads/workbench/5.2.html.