Skip to the content
mantichora_/docs

Editing rows

The rows of one table can be changed right in the result. Nothing is written as you type: the changes wait, marked, until you apply them, and you can read the statements first.

When a result can be edited

The strip above the grid says Editable or Read-only, and when it is read-only, why. A result is editable when one statement read one table and every row of it can be found again by a key. It is read-only when, for instance:

  • the connection is read-only, or its driver cannot tell where a result’s columns come from, as DuckDB’s cannot;
  • the statement joins tables, groups, uses DISTINCT, UNION or WITH, or reads from a subquery or a function;
  • it uses ORDER BY or LIMIT: sort in the grid instead;
  • the table has neither a primary key nor a unique index, or the key’s columns are not among those selected.

Changing, adding, deleting

Double-click a cell, or press Enter on it, and type; Enter keeps the value and Escape drops it. A cell’s right-click menu has Edit cell, Set NULL, Add row and Delete row; a row already marked for deletion offers Keep row instead.

Show the cell value, Ctrl+Shift+V, opens the value in a pane of its own, roomy enough for long text, with Empty string and a switch As an SQL expression, which writes what you type as an expression rather than as a value.

Applying

Edited cells and new rows stay marked, and the strip counts them: 3 unapplied. Three buttons decide what happens to them.

PreviewOpens What will run, the statements that would be sent. The text is shown, not executed: the values go as parameters.
ApplyWrites them. Ctrl+Shift+Enter.
RevertThrows them away. Ctrl+Alt+Z.

A row that cannot be written says why, one line each: Row 4: and the server’s reason. When somebody else changed a row after you read it, the window says so and offers Write anyway; a new row that misses a value the table requires says which.