Skip to content

Data grid: editing the same field a second time fails with “0 rows updated when that should have been 1” #2568

Description

@streikpc

Description

When editing data directly in the Data grid, the first modification of a field is saved correctly.

However, if I return to the same field in the same row and modify it a second time, HeidiSQL fails to save the new value and displays the following error:

0 rows updated when that should have been 1.

The problem is not limited to a particular data type. I have reproduced it with different field types, including VARCHAR, INT, TEXT, etc.

If I press the Reload/Refresh button after the first modification, I can modify the same field again without receiving the error.

This means that, after changing a field, I currently have to reload the table data before I can edit that field a second time.

This is an important issue for users who edit records directly in HeidiSQL, because reloading the data after every modification should not be necessary.

HeidiSQL version and OS

HeidiSQL 12.20.0.7320

Database server version

MariaDB-11.8.5

Reproduction recipe

  1. Open an existing MariaDB table in HeidiSQL.
  2. Open the Data tab.
  3. Select an existing row.
  4. Edit the value of a field, for example changing Value A to Value B.
  5. Move to another row so that HeidiSQL saves the modification.
  6. Verify that the first modification is saved correctly.
  7. Return to the same row and the same field.
  8. Change the value again, for example from Value B to Value C.
  9. Move to another row so that HeidiSQL attempts to save the second modification.
  10. HeidiSQL displays:
0 rows updated when that should have been 1.
  1. Press the Reload/Refresh button.
  2. Edit the same field again.
  3. The modification is now saved correctly.

Actual behavior

The first modification is saved correctly, but a second modification of the same field fails until the table data is reloaded.

Expected behavior

After successfully saving the first modification, HeidiSQL should update its internal representation of the row so that the same field can be modified again without having to reload the data.

The second modification should be saved normally.

Possible cause

This is only a hypothesis, but it appears that the Data grid may retain the original value of the row after the first update.

Consequently, when HeidiSQL generates the second UPDATE statement, it may use an outdated value in the WHERE clause. MariaDB then finds no row matching that outdated value, and HeidiSQL reports that zero rows were updated.

Reloading the data probably refreshes the stored row values, which would explain why editing works again immediately after pressing Reload.

Why this is important

Direct editing in the Data grid is one of HeidiSQL's main workflows.

Requiring users to reload the data after every modification:

  • interrupts normal data-entry work;
  • makes repeated corrections unnecessarily slow;
  • may cause users to believe that their data was not saved correctly;
  • makes direct editing unreliable for frequent database maintenance.

Error/Backtrace

0 rows updated when that should have been 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedIssue verified by project memberenhancementEnhances an existing featurenettype-mysqlMySQL and/or MariaDB specific issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions