Schema-aware autocomplete
psql+ completes more than keywords. It reads your live database catalog and understands the statement you are writing, so what you press Tab on is scoped to what actually makes sense at that point in the query — and everything respects your current search_path.
Press Tab to complete; press it twice to list candidates.
What it completes
- Table and view names — drawn from your schemas on the
search_path, with schema-qualified names available when you need them. - Column names inside
SELECT— scoped to the tables in yourFROMclause, not every column in the database. - Join keys after
ON— psql+ suggests the columns that plausibly join the two sides, foreign keys first. - Enum values in comparisons — when a column is an
enumtype, comparing it offers the actual labels. - Function names — including your own, again respecting
search_path.
A worked example
Watch how completion narrows as the statement takes shape:
SELECT u.<TAB> -- only columns of "users" (aliased u)
FROM users u
JOIN orders o
ON u.<TAB> -- join keys: id (FK target) suggested first
= o.user_id
WHERE o.status = '<TAB>' -- enum labels: 'pending', 'paid', 'refunded'
AND u.created_at > now();
In a bare SELECT <TAB> before the FROM is written, psql+ falls back to offering tables and broadly-scoped columns; once the FROM exists, column completion tightens to those tables.
It reflects your real schema
Completion is built from the live catalog, queried as you go — not a static word list or a cached dump. That means:
- New tables, columns, and enum values show up as soon as they exist.
- Renames and drops disappear immediately.
- What you are offered is what the server will actually accept.
Respecting search_path
Everything honors search_path. An unqualified table name completes from the schemas on your path, in order, exactly as the server would resolve it at execution time. If a name lives outside your path, schema-qualify it (reporting.<TAB>) and completion follows you into that schema.
This keeps autocomplete consistent with the prompt: the names you are offered are the names that will resolve the way you expect.
Works against a pgpg sandbox
Because completion only needs a catalog to read, it works against any connection that speaks PostgreSQL — including a pgpg sandbox connection. You get the same schema-aware completion when exploring a sandboxed branch of your database as you do against the real thing, which makes it safe to experiment with destructive statements before running them for real.