Rowan User Guide

Chapter 5

Edit data

Change values right in the grid, add and delete rows, then look over exactly what Rowan will send before you commit it all at once.

How changes are staged#

When you edit a cell, add a row or delete one, nothing is written to the database yet. The change is staged: Rowan keeps it, tints it in the grid, and adds it to the workspace's pending changes.

The grid with a new row at the top in green, an edited note in orange and a deleted row struck through in red
Staged changes: a new row (green), an edited cell (orange) and a deleted row (red, struck through).

While you have staged changes, the toolbar shows Discard, Preview and Commit.

The Discard, Preview and Commit buttons in the toolbar
The commit control appears only while something is pending.

When you commit, Rowan sends every staged change in one transaction, as parameterized statements. If any statement fails, the whole transaction is rolled back and nothing changes; Rowan shows which statement failed so you can fix it and try again.

Staged changes cover everything in the workspace: rows in every table tab and split pane, editable query results, and structure changes. They survive switching tabs, so you can edit several tables and commit them together.

Tip

To change the tint colors for new, modified and deleted rows, open Settings > Fonts & Colors.

Edit cells#

  1. Double-click a cell, or select it and press Enter, or just start typing.
  2. Type the new value.
  3. Press Enter to keep it, or Esc to cancel. Tab keeps it and moves to the next cell in the row.
A note cell open for editing in the grid
Editing a cell in place. The edit is staged when you press Enter.

To toggle a boolean, click its checkbox or press Space. To edit a long value, use Quick Look (CtrlEnter) or the right sidebar.

Set Value and the date picker#

Some values can't be typed as text. Press AltEnter, Alt-click a cell, or right-click it and choose Set Value. The menu offers only what fits the column:

The Set Value menu open on a created_at cell, offering NULL, DEFAULT, NOW() and Choose Date
Set Value on a timestamp. NULL is dimmed because the column doesn't allow it.
EMPTY
An empty string, for text columns.
NULL
No value. Dimmed when the column is NOT NULL.
DEFAULT
The column's default, as the server works it out when you commit.
NOW()
For date and time columns, the current time as the server sees it when you commit.
Choose Date…
For date and time columns, a calendar with the time below it. Now picks the current moment; Page Up and Page Down change month.
Add a File…
For binary columns, loads a file's contents into the cell.

DEFAULT and NOW() are sent as SQL keywords, never as text. With several cells selected, the value goes into all of them.

Insert, duplicate, paste and delete rows#

Add a row
Press CtrlI, click + in the bottom bar, or double-click below the last row. The new row appears at the top. Columns the server fills in, such as identity keys, read generated; columns you must fill in read required.
Duplicate rows
Select rows and press CtrlD. The copies are staged as new rows, with their keys and generated columns left for the server.
Paste rows
CtrlV pastes rows from the clipboard as new rows. Copy them from Rowan or from a spreadsheet, with the columns in table order.
Paste into cells
CtrlShiftV pastes into the selected cells instead, changing them.
Delete rows
Select rows and press Delete. They stay visible, struck through, until you commit. To take a delete back, right-click and choose Restore Row, or delete the row again.

The code preview#

Before you commit, you can see the exact SQL Rowan will send. Click Preview in the toolbar, or press CtrlShiftP.

The code preview popover showing BEGIN, three UPDATE statements with their values, and COMMIT
The code preview: every statement, in BEGIN … COMMIT, grouped by table, with each statement's values beside it.
  • Statements are grouped by table with a summary, such as -- public.orders: 3 updated. Structure changes come first, then rows.
  • Each statement's values are listed beside it as $1, $2 and so on, because that's how they're sent.
  • What the preview shows is exactly what's sent; nothing is added or rewritten later.
  • Statements that PostgreSQL can't run inside a transaction, such as CREATE INDEX CONCURRENTLY, are listed after the commit, and the preview says so.

From the preview you can Discard, Commit, or choose Open in Window to keep the preview in a window of its own. That window follows every edit, undo and discard as you make them, and you can commit from there too. Press Esc or CtrlShiftP again to put the popover away.

The code preview in a window of its own, over the grid, listing three UPDATE statements between BEGIN and COMMIT
The code preview in its own window. It stays open while you keep editing.

Commit and discard#

  • To commit, click Commit or press CtrlS. Every staged change in the workspace is sent in one transaction.
  • To throw everything away, click Discard or press CtrlShiftDelete.

If a commit fails, Rowan rolls it back, opens the preview with the failed statement tinted, and offers Show Row to take you to the row that caused it. Your staged changes are still there to fix.

Every commit is also written to History with its statements, its values and, for updates and deletes, what each row held before (-- was: status = 'paid'). If you ever need to put a change back by hand, the old values are there.

Note

If the connection uses Safe Mode, Rowan asks before the commit is sent, and may ask for the database password. See Safe Mode.

Undo and redo#

Press CtrlZ to undo the last staged change, and CtrlShiftZ or CtrlY to redo it. Undo covers cell edits, new, duplicated, pasted and deleted rows, and structure changes, in the order you made them. Once you've committed, the changes are in the database; use History's old values to reverse one.

Tables without a primary key#

Rowan only edits rows it can identify for certain, and that takes a primary key. A table without one opens read-only, with a note above the grid:

The newsletter_signups table with a note saying it has no primary key and is read-only
A table without a primary key can be browsed, filtered and exported, but not edited in the grid.

You can still browse, filter, copy and export its rows, and change them with SQL in the editor. To make the table editable, add a primary key in its Structure view.