[IGN-14601] Database Query Browser can destroy table records when editing sorted data

v8.1 / v8.3

A colleague found out the hard way that if you sort the result set from a query in the DB query browser and then edit the records and apply them, the edits are applied to the same selected indexes (not ids), of the unsorted table data. I.e. it will most likely edit the wrong records :dizzy_face:

This could be catastrophic for your table data.

Note in the screen capture the critical part is sorting the field, in this case the "name" field so that it reorders the data.

8 Likes

Dang, this is one of the oldest bugs I've seen in a while; the affected parts of this code haven't changed since we switched from another VCS system to git in 2011. And after all that time it's the classic Swing model index vs view index bug.

3 Likes

Huh. I never noticed that it was even possible to edit in the designer query browser result sets.

The edit button only enables if we detect the result set has a 'primary key' field we can use to correlate the edits back.