Skip to content

Pressing Down on last row of a non-editable query result triggers "Grid editing error" #2596

Open

Description

@Friedrich2

Description

Description

When navigating a query result grid with the keyboard, pressing the Down
arrow while the last result row is focused attempts to insert a new row.

For a non-editable result set involving more than one table, this causes
HeidiSQL to display a modal error such as:

Grid editing error
More than one table involved.

This happens although the user is only navigating through the result set
and has not requested an INSERT or any other modification.

Using the mouse wheel or scrollbar does not trigger the error.

Actual result

A modal dialog appears:

Grid editing error
More than one table involved.

Expected result

Pressing Down at the end of a non-editable result set should not initiate
row insertion and should not display an editing error.

The focus could simply remain on the last row.

Technical note

The current master source appears to explain the behavior.

In source/main.pas, TMainForm.AnyGridKeyDown invokes
actDataInsertExecute(actDataInsert) whenever VK_DOWN is pressed while
the last grid node is focused.

actDataInsertExecute subsequently calls Results.CheckEditable.
For a result involving multiple tables, this raises an EDbError which is
then displayed as a "Grid editing error".

So the INSERT shortcut itself appears intentional, but it is also invoked
for result sets for which insertion is not possible.

A possible fix would be to avoid starting the insert action when keyboard
navigation reaches the lower boundary of a non-editable result set.

HeidiSQL version and OS

HeidiSQL 12.13.0.7147, Windows

Database server version

PostgreSQL 17.7.0

Reproduction recipe

Run this read-only query in a query tab:

SELECT
    c.oid AS class_oid,
    n.oid AS namespace_oid
FROM pg_catalog.pg_class AS c
JOIN pg_catalog.pg_namespace AS n
    ON n.oid = c.relnamespace
ORDER BY c.oid
LIMIT 2;

Then:

  1. Focus a cell in the result grid.
  2. Navigate to the last result row using the Down arrow key.
  3. Press Down once more.

Error/Backtrace

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDefective behaviour in HeidiSQL

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions