Docs / Stash and edit modes
Stash and edit modes
No-Edit mode for production, and Stash, which keeps original rows before updates and deletes.
Edit / No-Edit
No-Edit is the default for production connections. The padlock in the title bar shows the current mode and toggles it, unless the connection itself is read-only. Restrictions are enforced in the backend for the grid, the query executor and MCP; changing CSS or request payloads cannot bypass them.
Stash
Stash is opt-in in Settings (⌘ ,) and defaults to 15 minutes of retention, adjustable from 1 to 1,440 minutes. Before an update or delete, QueryBench captures the database's actual previous values, not the stale row from the interface. Capture and mutation share a transaction; on PostgreSQL and MySQL the capture locks the matching rows. If capture fails, the write is aborted.
- Recovery output contains INSERT statements for deleted rows and UPDATE statements for updated primary-key rows. Binary data, JSON, NULL and large numbers are preserved; generated columns are omitted.
- The Stash view shows timestamp, row count, pending, committed or rolled-back status, expiry and the recovery SQL. Copy the statements or open them in a query tab.
- QueryBench never applies recovery automatically. Restoring old values can overwrite newer writes; triggers and cascades are not reversed.
- Supported capture adapters: PostgreSQL, MySQL, SQLite and DuckDB. Other adapters reject modifications while stash is enabled.
Rolling back a change
Stash never applies recovery on its own. The walkthrough below is the whole procedure.
- Open Tools › Stash (on phones: Settings › View stash). Entries are listed newest first with timestamp, table, row count, status and time left before expiry.
- Select the entry for the change you want to undo. The right pane shows the recovery SQL: INSERT statements for rows you deleted, UPDATE statements for rows you changed.
- Check the statements. Restoring old values overwrites anything written to those rows since, and triggers or cascades from the original change are not reversed.
- Click Open recovery SQL to load the statements into a query tab, or Copy statements to paste them elsewhere.
- Run them with ⌘ Enter in Execute mode. The connection must be in Edit mode; No-Edit and read-only connections are enforced in the backend.
- Entries expire automatically after the retention period. Clear stash removes them immediately.
Manual SQL
With stash enabled, manual SQL accepts single-table UPDATE and DELETE statements with literal SET values and a WHERE clause of comparisons joined by AND. Expressions, joins, subqueries, missing WHERE clauses and routines are rejected before execution. A batch is validated before any statement runs, then each statement commits independently.