Chapter 6
Structure
See and change how a table is built: its columns, keys, indexes and triggers. Structure changes are staged like data edits and committed the same way, so you can review the DDL before it runs.
The Structure view#
To see a table's structure, click Structure in the bottom bar, or press CtrlAlt]. CtrlAlt[ goes back to its data. You can also right-click a table in the sidebar and choose Open Structure.

At the top are the table's Name, its Primary key and its comment, with a search field for tables with many columns. Below are the columns, with column_name, data_type, is_nullable, column_default, foreign_key and comment, then the table's constraints.
The bottom bar's Index, Triggers and DDL show the rest of the table's definition.
Columns, keys and defaults#
Every cell in the columns list can be edited in place. Double-click it, or select it and press Enter.
Cells with a menu show an arrow; click it, or press AltEnter, to open the menu with its list already showing.
- To add a column, press CtrlI, click + in the bottom bar, or double-click below the last column.
- To drop a column, select it and press Delete. It's marked until you commit; press Delete again, or choose Restore Column, to keep it.
- To change the primary key, open the Primary menu at the top and check the columns it should cover. A primary key column is always NOT NULL.

Select several columns and press Space to edit their type, nullability, default and comment together in the right sidebar. With one column selected, the sidebar lists what uses it, such as indexes and keys.
Indexes, triggers and DDL#
Index#
Click Index in the bottom bar to see the table's indexes, with their columns or expressions, method, whether they're unique, and any condition.

- Choose New Index, or double-click below the list, to add one. Set its name, columns, method (such as
btreeorgin), whether it's unique, and an optional condition for a partial index. - Check concurrently to build it without locking the table. Rowan runs that statement after the transaction, since PostgreSQL requires it, and the preview says so.
- Changing an index drops it and creates it again.
Triggers#
Click Triggers to see the table's triggers: name, timing, events, level, the function it calls, its condition, and whether it's enabled.

Choose New Trigger to add one. The function menu lists trigger functions first. In PostgreSQL a trigger always calls a function; to change what it does, open the function from the sidebar and edit its source.
DDL#
Click DDL to see the server's own definition of the table, with its indexes and comments. Press CtrlShiftC, or click Copy, to copy it.

Commit structure changes#
Structure changes are staged with your data edits. The Preview shows the DDL Rowan will run, structure first, then rows, all in one transaction. Commit with CtrlS, discard with CtrlShiftDelete, and undo with CtrlZ. See The code preview.
Create, rename, clone, truncate and delete tables#
Create a table#
- Click + at the bottom of the left sidebar and choose New Table….
- Enter its name and choose Create. A Structure tab opens with an
ididentity column as its primary key. - Add the columns you need.
- Press CtrlS. Until you commit, the table doesn't exist on the server; discarding closes its tab.
Other table actions#
Right-click a table in the sidebar:
Each is staged until you commit. Pressing Delete on a selected table in the sidebar stages a drop straight away, and AltDelete stages a truncate. They still wait for CtrlS.
Views, materialized views, functions and schemas#
Click Tables, Views or Functions in the sidebar for an overview of everything of that kind in the schema, with row estimates, sizes including indexes, and comments. Double-click one to open it.