PGQViewer

Querying

Two editor modes share one CodeMirror 6 editor: graph mode takes nothing but a MATCH pattern, SQL mode runs whatever you type, verbatim.

Graph mode

Type just the pattern — PGQViewer wraps it into a full SELECT … FROM GRAPH_TABLE (…) statement, auto-projecting every key and property column needed to reconstruct vertex and edge identity (its substitute for the ELEMENT_ID()function PG19 doesn't ship yet). Vertices bind in parentheses, edges in brackets:

graph mode
(a IS person)-[k IS knows]->(b IS person)

WHERE clauses inside an element filler work as expected:

graph mode
(a IS employee WHERE a.salary > 150000)-[k IS reportsto]->(b)
  • Labels are case-folded by PostgreSQL unless they were quoted at CREATE time.
  • One path pattern per MATCH — a PG19 limit. Patterns spanning multiple paths belong in SQL mode as joined GRAPH_TABLE calls.
  • Label disjunctions like (x IS a|b) are rejected with a hint to use SQL mode.
  • Graph mode only ever issues SELECTs, and a LIMIT field next to the Run button caps the result.

SQL mode

Verbatim PostgreSQL — multiple GRAPH_TABLE calls joined together, ordinary SELECTs, recursive CTEs, EXPLAIN, EXPLAIN ANALYZE, SET LOCAL. Results land in a sortable, filterable table.

SQL mode
-- anything PostgreSQL accepts, verbatim:
EXPLAIN ANALYZE
SELECT *
FROM GRAPH_TABLE (social
  MATCH (a IS person)-[k IS knows]->(b IS person)
  COLUMNS (a.name AS src, b.name AS dst)
);

-- positional parameters come from the Parameters drawer,
-- a JSON array bound to $1, $2, …
SELECT * FROM people WHERE born > $1;

Run, cancel, stream

Press ⌘/Ctrl + Enter or click Run. Results stream in as NDJSON — the canvas and table fill in as rows arrive. While a query runs, the button morphs into a red Cancel that calls pg_cancel_backend() on the exact backend executing your query. Numbers that would lose precision in JavaScript — bigint beyond 2⁵³, numeric, uuid, interval, bytea — are stringified server-side, so the renderer never silently drops digits.

Autocomplete, history, hints

  • Autocomplete— SQL/PGQ keywords plus live label and property completions from the connected graph's metadata.
  • History — per-mode query history on Ctrl/Cmd-↑↓ (last 20 queries).
  • Error hints — around 25 PG19 SQL/PGQ error messages map to plain-language explanations with PostgreSQL docs links. Unknown error? Copy it into a GitHub issue — patterns are easy to add.
  • Snippets — click any element in the schema sidebar to drop a ready-to-edit MATCH snippet into the editor.

Keyboard shortcuts

KeysAction
⌘/Ctrl + EnterRun the query
⌘/Ctrl + KCommand palette — theme, accent palettes, switch graph
Ctrl/Cmd + ↑ / ↓Walk per-mode query history
⌘/Ctrl + FFind in editor
⌘/Ctrl + Z / Shift+ZUndo / redo
TabIndent
EscClose modal / dropdown / focus mode