Editing row data when primary key not in the data being edited

LR's profile image LR posted 2 years ago in General Permalink

Hello.

I am using HeidiSQL 12.0.0.6512 on Windows 10 against MariaDB 5.5.

When I perform a query in a query tab as select * from table, I can edit the data displayed in the grid.

When I change that query to select columnX, columnY from table, and none of the columns are the primary key, I cannot edit the data in the grid. Cells in the grid will accept focus but I cannot change the value.

Before finding HeidiSQL, I used MySQL Query Browser which would allow editing even if the primary key wasn't in the result set. It's not a problem in the slightest, but I noticed it and thought it would be nice to have that feature in HeidiSQL.

Thank you and have a great day!

LR

ansgar's profile image ansgar posted 2 years ago Permalink

That's intentionally, and makes UPDATES and DELETEs safe against ambiguous rows. You need to select the primary key of a table, or a non-null UNIQUE key, if you want to makes updates.

Please login to leave a reply, or register at first.