简体   繁体   中英

table not editable mysql workbench error

I have a table that has no primary key. All I want to do is see the data. I DO NOT WANT TO EDIT IT. Yet, whenever I run this query...

SELECT * FROM TableThatHasNoPrimaryKey  

MySQL Workbench (version 5.2.36 v8542, running on Ubuntu 10.04 64 bit) gives me this error...

table data is not editable because there is no primary key defined for the table

Is this a bug? This query displays the data just fine on MySQL browser.

SELECT * FROM(SELECT * FROM TableWithNoPrimaryKey)AS tmp

Another workaround

select *, char_length('') from tableName

Using a function in the select statement gets around the issue

I found this on internet:

try this launch the workbench using:

"mysql-workbench --log-level=debug3"

it's a bug, take a look here:

http://bugs.mysql.com/bug.php?id=62893

if not you will have to add a primary key, take a look to this forum

MYSQL and python error

I use this as a workaround:

DROP TEMPORARY TABLE IF EXISTS TempTableThatHasNoPrimaryKey;

CREATE TEMPORARY TABLE TempTableThatHasNoPrimaryKey
SELECT *
FROM TableThatHasNoPrimaryKey;

SELECT * FROM TempTableThatHasNoPrimaryKey

for some strange reason this works...

要在mysql工作台中以编辑模式打开表,您需要在表中有一个主键列,否则它始终只能以读取模式打开。

如果只需要从表中获取数据,则可以为此创建Views

重新启动工作台为我修复了它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM