A PostgreSQL plugin for Tabularis, the open-source database client.
This plugin connects Tabularis to PostgreSQL via a standalone Rust binary speaking JSON-RPC 2.0 over stdio, replacing what was originally a built-in driver compiled directly into the Tabularis application. It is byte-for-byte behaviorally identical to that built-in driver, proven by an 82-test parity suite that runs both drivers against the same live database and compares every response.
Requires Tabularis v0.20.0 or later. This plugin relies on the plugin runtime introduced in that release; it will not load on earlier versions of Tabularis.
- Features
- Screenshots
- Connection Configuration
- Supported PostgreSQL Data Types
- Installation
- How It Works
- Supported Operations
- Building from Source
- Development
- Changelog
- Maintainers
- License
- Connection — Host/port or connection-string connections, with SSL (
disable,allow,prefer,require,verify-ca,verify-full) viarustls. - Schema Browsing — Databases, schemas, tables, views, materialized views, routines (functions/procedures), and triggers.
- Column & Key Metadata — Column types (including enum labels and pgvector-style
extension types via
udt_namefallback), indexes (including composite/unique), foreign keys (including cross-schema). - Query Execution — Arbitrary SQL with pagination,
EXPLAIN/EXPLAIN ANALYZE, and multi-statement batches that share a single connection (soBEGIN/COMMIT, temp tables, andSETsurvive across statements). - Inline Editing — Insert, update, and delete rows directly from the Tabularis
data grid, with type-aware value binding (enum
CAST, UUID, JSON/JSONB, arrays, temporal types, BLOB wire format). - DDL Generation —
CREATE TABLE,ADD COLUMN,ALTER COLUMN(including implicit-cast-compatibleTYPEchanges),CREATE INDEX,ADD CONSTRAINT FOREIGN KEY, plus the corresponding drops. - Column Comments — The
column_commentscapability enables descriptions in Add/Modify Column. Comment edits generateCOMMENT ON COLUMN; clearing a description removes it withIS NULL, without restating the column definition. - View & Trigger Lifecycle — Create/alter/drop views, create/drop triggers, refresh materialized views.
- BLOB Support — Export a
byteacolumn to a file or preview it as a MIME-sniffed data URL. - Cross-platform — Pre-built binaries for Linux (x86_64/aarch64), macOS (x86_64/aarch64), and Windows (x86_64).
![]() PostgreSQL in the database picker |
![]() Connection configuration |
![]() Multi-schema browsing |
![]() Data grid with enum support |
| Parameter | Description | Required |
|---|---|---|
host |
PostgreSQL server hostname | Yes (unless using connection_string) |
port |
PostgreSQL server port (default 5432) |
No |
database |
Database name to connect to | Yes (unless using connection_string) |
username |
Database user | Yes (unless using connection_string) |
password |
Database password | If required by the server |
ssl_mode |
disable, allow, prefer, require, verify-ca, or verify-full |
No |
ssl_ca |
Path to a custom CA bundle PEM file. Required for verify-ca (platform roots aren't used for this mode); optional for verify-full, where it overrides the system trust store |
No |
ssl_cert |
Path to a client certificate PEM file, for servers requiring mutual TLS (e.g. Google Cloud SQL). Must be set together with ssl_key |
No |
ssl_key |
Path to the private key PEM file matching ssl_cert. Must be set together with ssl_cert |
No |
unix_socket_path |
Path to a Unix socket file (/var/run/postgresql/.s.PGSQL.5432) or its directory. When set, the plugin dials the socket instead of host/port, and TLS is forced off (a socket peer cannot negotiate it). The host strips this when a tunnel is active, so the tunnel owns the route |
No |
connection_string |
Full postgres://user:pass@host:port/db URL, as an alternative to the discrete fields above |
No |
startup_script |
SQL run on every new pooled connection (e.g. SET search_path = ...) before it's handed to a query. Not run for a read-only connection |
No |
read_only |
Set by the host for a read-only connection. The plugin opens it on its own pool with default_transaction_read_only=on and skips the startup script (see Protected read-only queries) |
No |
| Category | Types |
|---|---|
| Numeric | SMALLINT, INTEGER, BIGINT, SERIAL, BIGSERIAL, REAL, DOUBLE PRECISION, NUMERIC, DECIMAL, MONEY |
| String | CHAR, VARCHAR, TEXT |
| Date/Time | DATE, TIME, TIMESTAMP, TIMESTAMPTZ, INTERVAL |
| Other | BOOLEAN, UUID, INET, CIDR, MACADDR |
| JSON | JSON, JSONB |
| Binary | BYTEA |
| Ranges | INT4RANGE, INT8RANGE, NUMRANGE, TSRANGE, TSTZRANGE, DATERANGE |
| Arrays | SMALLINT[], INTEGER[], BIGINT[], REAL[], DOUBLE PRECISION[], TEXT[], VARCHAR[], BOOLEAN[] |
This plugin is published on the Tabularium registry — the same one the DuckDB and Elasticsearch plugins ship through. Install it from Tabularis's in-app plugin browser: Settings → Plugins, search for PostgreSQL, and install.
If you point Tabularis at a different Tabularium instance via
tabulariumRegistryUrl in config.json, make sure that registry has
ingested this plugin's releases first.
-
Download the latest release for your platform from the Releases page — look for the most recent
1.0.0-rc.Ntag (releases through1.0.0-beta.10shipped on thebetachannel; new releases from1.0.0-rc.1onward ship on thercchannel — see Contributing: PR Titles & Versioning). -
Extract the archive.
-
Copy
postgresql-plugin(orpostgresql-plugin.exeon Windows) and.tabulariuminto the Tabularis plugins directory:OS Plugins Directory Linux ~/.local/share/tabularis/plugins/postgresql/macOS ~/Library/Application Support/tabularis/plugins/postgresql/Windows %APPDATA%\tabularis\plugins\postgresql\ -
Restart Tabularis.
The plugin is a standalone Rust binary that communicates with Tabularis through JSON-RPC 2.0 over stdio:
- Tabularis spawns the plugin as a child process.
- Requests are sent as newline-delimited JSON-RPC messages to the plugin's
stdin. - The plugin connects to PostgreSQL using
tokio-postgres/deadpool-postgresand writes responses tostdout.
Connection pools are cached in-process, keyed by
host:port:database:user:startup_script plus every TLS param
(ssl_mode/ssl_ca/ssl_cert/ssl_key), so repeated calls against the
same target with identical connection settings reuse an existing pool
instead of reconnecting.
| Method | Description |
|---|---|
initialize / shutdown |
Plugin lifecycle hooks called on load and unload |
test_connection / ping |
Verify connectivity with a lightweight SELECT 1 |
get_databases |
List databases on the server |
get_schemas |
List schemas in the connected database |
get_tables |
List tables in a schema |
get_columns / get_view_columns / get_materialized_view_columns |
Column metadata for tables, views, and materialized views |
get_table_ddl |
Reconstructed CREATE TABLE statement for an existing table, used by schema dumps |
get_indexes |
Index metadata, including composite and unique indexes |
get_foreign_keys |
Foreign key metadata, including cross-schema references |
get_views / get_view_definition / create_view / alter_view / drop_view |
View lifecycle |
get_materialized_views / get_materialized_view_definition / refresh_materialized_view |
Materialized view lifecycle |
get_routines / get_routine_parameters / get_routine_definition |
Function/procedure metadata |
get_triggers / get_trigger_definition / create_trigger / drop_trigger |
Trigger lifecycle |
execute_query / execute_query_batch / explain_query |
Query execution, multi-statement batches, and query plans. Both query methods accept an optional session_id that keeps the connection while an explicit transaction is open, and manual_commit for an editor tab in Manual commit (see Manual commit) |
execute_read_only_query |
Same request and response as execute_query, run in a transaction the database itself will not let write (see Protected read-only queries) |
read_rows |
Lossless, optionally-snapshot read for host-driven table-to-table copy (see Table copy). Returns every non-native value as the server's own ::text output (full bytea as base64) plus the PostgreSQL type name + OID per column. An optional session_id pins a REPEATABLE READ READ ONLY snapshot across pages; release with release_session. Gated by the table_copy capability |
insert_records |
Batch typed insert for the table-copy write side (see Table copy). Reuses the type-aware binding cascade with column types discovered once per batch, in one transaction so a failed batch writes none of its rows. Gated by the table_copy capability |
release_session |
Rolls back and releases the connection a session pinned for an open transaction |
commit_session / rollback_session / get_session_state |
End a session's transaction, or report whether it holds one (see Manual commit) |
insert_record / update_record / delete_record |
Row-level CRUD with type-aware value binding |
get_create_table_sql / get_add_column_sql / get_alter_column_sql / get_create_index_sql / get_create_foreign_key_sql / drop_index / drop_foreign_key |
DDL generation and execution |
save_blob_to_file / fetch_blob_as_data_url |
BLOB (bytea) export and preview |
import_database_sql |
Transactional SQL file import: the whole file runs in one transaction, all-or-nothing |
The plugin declares independent empty_database, truncate_database, and
drop_database capabilities for Tabularis's More Database Operations menu.
Empty removes user objects while preserving the database and schema ownership,
permissions and comments. Truncate clears all local user tables across schemas
and resets identities without dropping objects; foreign tables are rejected.
Both operations use a transaction. Drop connects through postgres and refuses
protected databases or databases still used by other sessions; it never forcibly
terminates unrelated clients. The explicit browsed database overrides the database
embedded in a legacy connection string. Read-only requests are rejected.
import_database_sql runs a .sql file in a single transaction on a dedicated
connection, so any failing statement rolls the whole import back. The error
names the statement number, its line and its text. The import prepends the
requested schema (default public) onto the connection's base search_path,
sets SET CONSTRAINTS ALL DEFERRED and SET LOCAL synchronous_commit = OFF,
and checks deferred constraints before COMMIT while the file's own session
state is still in place. Unlike the former built-in driver, which replaced the
search_path, the base path stays reachable, so unqualified names that are
absent from the requested schema can still resolve through it. The Tabularis
host does not send a target schema over this RPC yet, so today every import
uses public. Statements are split on ; outside strings, quoted identifiers,
dollar-quoted bodies, comments, parentheses and BEGIN ATOMIC bodies, and are
streamed from disk with only a few held in memory. A single statement is
limited to 1 GiB, the most PostgreSQL accepts. The plugin reports no progress
while it runs, only the final statement count.
Because the import owns the transaction, BEGIN and COMMIT lines in the file
are skipped, and the returned count covers only the statements that ran.
ROLLBACK, COMMIT AND CHAIN, PREPARE TRANSACTION,
COPY ... FROM STDIN / TO STDOUT and psql meta-commands (\connect, \i)
are rejected with an explanation (\restrict and \unrestrict, which recent
pg_dump versions emit, are skipped); use pg_dump --inserts for dumps that
would otherwise rely on COPY ... FROM STDIN. A file's own
SET TRANSACTION ISOLATION LEVEL still works, but the options on a BEGIN
line are dropped with it. Anything that could turn standard_conforming_strings
off (SET to anything but on, RESET, RESET ALL, set_config) is rejected,
because it would change how the rest of the file's strings are read. Each
statement is sent as exactly one command, so a statement the splitter cannot
separate fails with an error instead of running extra commands. When the
connection carries a legacy connection string, its host, port and credentials
are used but the database the user picked wins. Creating a database during
import is not supported, and read-only connections are rejected.
Cancelling the call stops the running statement, is noticed between statements
and just before COMMIT, and rolls everything back. Session settings a dump
makes (set_config(..., false), SET ROLE) are reset before COMMIT, so they
cannot leak to other clients behind a transaction pooler. The import holds one
of the plugin's four general workers for its whole run.
The plugin declares read_only_queries, so the host sends execute_read_only_query
for a read-only connection and for MCP queries on a writable one. The request
and response match execute_query (query, limit, page, schema), and the
host never falls back to execute_query.
Each call runs as BEGIN READ ONLY, the query, then ROLLBACK, and reads
transaction_read_only back to confirm the server really entered a read-only
transaction; if it did not, the query is not run. INSERT, UPDATE, DELETE,
DDL and a function call that writes all fail in the database and change
nothing. A function or DO block cannot switch the transaction back to
writable, because SET TRANSACTION READ WRITE is only accepted before the first
query of a transaction. A query that opens or ends a transaction (BEGIN,
COMMIT, ROLLBACK, PREPARE TRANSACTION) is refused, since the call owns its
transaction. PostgreSQL's read-only mode also rejects nextval() and temporary
tables.
A read-only transaction does not cover everything, so the plugin refuses a few
commands by name and checks the connection afterwards. PREPARE and
DEALLOCATE are refused, because they change what the connection keeps for the
next caller. COPY is refused, because COPY ... TO can write a server-side
file or run a program. ANALYZE, CLUSTER, REINDEX, CHECKPOINT and LOAD
are refused because they write statistics, rewrite storage or load code, and
DISCARD is refused because DISCARD SEQUENCES resets state that ROLLBACK
does not restore. This list stops a mistake by a person or a tool that sends one
of these commands as the statement; it is not a boundary. Dynamic SQL (a DO
block, a function) can run the same commands from inside, where the plugin
cannot see them, so what bounds the protection is the role (below). What the
plugin does catch after the call is the session state a connection keeps: it
reads back prepared statements and session-level advisory locks, and closes the
connection instead of pooling it when the call left either behind.
PostgreSQL's read-only mode is still bounded by the connecting role. Functions
that act outside the transaction, such as pg_create_physical_replication_slot,
pg_logical_emit_message or pg_switch_wal, are allowed in it, and dblink
(where installed) opens a separate session that is not read-only. Connect with
a role that has only the privileges a read-only user should have. The host must
be Tabularis v0.33.0 or later for read_only_queries; an older host never sends
execute_read_only_query.
The connection goes back to the pool only after ROLLBACK succeeded and the
session is as clean as it was. If the ROLLBACK fails, or the call is
cancelled or dropped part-way, the connection is detached, the statement still
running on it is cancelled, and the socket is closed, so the next caller never
inherits a read-only or half-finished session. A cancel that arrives while the
call is still connecting, or between its own BEGIN and the query, stops the
call before the query runs.
A connection saved with read_only = true gets its own pool (keyed apart from
the writable one) whose new sessions run SET default_transaction_read_only = on
before they are handed out, so its connection test and metadata discovery
cannot write either. It is a statement and not a startup option, because
PgBouncer rejects that option in the startup packet in every pool mode. The host
leaves out the saved startup_script for such a connection, and the plugin
never runs one for it.
Behind a transaction pooler (pooler_mode = transaction) the statement is not
run, because a session-level SET would land on a backend other clients share,
and the pool is keyed apart again so editing pooler_mode never reuses the
wrong pool. The per-call BEGIN READ ONLY is the protection there: a query that
returns rows runs on a dedicated connection that is closed afterwards, and any
other statement runs on the shared pool, where BEGIN pins the backend for the
call. A closed connection does not close the backend behind a pooler, so the call
releases the session-level advisory locks and PREPAREd statements it created in
the same message as its ROLLBACK.
The plugin declares manual_commit, so a Tabularis editor tab can run in
Manual commit: its statements stay in one transaction until the user clicks
Commit or Rollback (tabularis#1745).
- A request with
"manual_commit": trueand asession_idjoins the session's transaction. Before each statement that finds no transaction open, the plugin sendsBEGIN, so the statements after a failure or a typedCOMMITin a batch start a new transaction instead of running in autocommit. The connection stays pinned while the transaction is open. A statement that opens the transaction itself (BEGIN ISOLATION LEVEL SERIALIZABLE) keeps its own. "manual_commit": truewithout asession_idis refused with-32602.- The
search_pathis set beforeBEGIN, as a session setting. Behind a transaction-mode pooler it is set inside the transaction withSET LOCAL, since a statement outside it may reach another backend. commit_sessionandrollback_session({ "session_id": "..." }) end the pinned transaction, release the connection and return{ "in_transaction": false }. A session with no transaction has nothing to end. A connection whoseCOMMITorROLLBACKfailed is closed instead of going back to the pool.get_session_statereports whether the session holds a transaction. A connection is only pinned while its transaction is open, so this is the real state.- Calls of one session run in the order the plugin received them, even though
several workers serve requests: a
release_sessionorrollback_sessionsent after a query waits for it, so the query cannot pin a transaction after its session was released. - A statement that fails inside the transaction rolls it back, as before, and
the response reports
in_transaction: false. This includes statements PostgreSQL refuses inside a transaction block, such asVACUUMorCREATE INDEX CONCURRENTLY. explain_queryandexecute_read_only_querydo not run in the session, so they do not see the transaction's uncommitted rows.
Requests without manual_commit behave as before, and a host that does not
know the capability never sends it.
read_rows (read) and insert_records (write) are the lossless copy path for
host-driven table-to-table copy (issue #207), declared via the table_copy
capability. The host gates its Transfer feature on that capability and calls
read_rows instead of execute_query when it needs a copy-grade read, and
insert_records to write rows back to a PostgreSQL target.
execute_query formats values for display — it truncates bytea to a 10 KB
preview, drops fractional seconds on time/timestamp, and drops both the
fractional seconds and the timezone offset on timestamptz. A copy built on that
format cannot meet the "reject any lossy conversion" rule the table transfer was
reviewed against.
read_rows does not decode values itself where PostgreSQL's text form is the
contract (issue #225). It runs prepare on the query for the column metadata,
then selects every column that is not a native JSON type through ::text, so
the value is exactly what the server's own output function prints:
- native, decoded from the binary wire format:
bool,int2/int4/int8,oid(JSON numbers/booleans),text/varchar/bpchar/name,uuid(strings),float4/float8(numbers, withNaNand±Infinityas the strings"NaN","Infinity","-Infinity"), andbytea(base64 in full, not the 10 KB preview) moneyas::numeric::text("123.45", not a locale-formatted amount)- everything else as
::text:numeric, dates and times (full fractional seconds, BC values as"0043-03-15 BC",infinity),timestamptzin UTC ("2026-11-29 13:45:30.345678+00"),interval,json/jsonb(exact text, so1e400, wide numbers andjsonduplicate keys survive), enums,inet, and arrays, ranges, multiranges and composites as PostgreSQL text ("{{1,2},{3,4}}","[2:3]={1,2}","[1,5)","(1,2)") — not JSON arrays or objects - the PostgreSQL type name and OID per column, so the host can plan the conversion; also returned for a result with zero rows
The read transaction sets DateStyle = 'ISO, MDY', IntervalStyle = 'postgres', extra_float_digits = 3, bytea_output = 'hex' and TimeZone = 'UTC' with SET LOCAL, so the text does not depend on the connection's
startup script (lc_monetary is not pinned: money[] keeps the server's
locale form), and always ends with ROLLBACK, so a query that changes a
setting with set_config(…, false) cannot leak it into the pooled connection.
Behind a transaction pooler (pooler_mode = "transaction") the read runs on a
one-shot connection and starts with DEALLOCATE ALL, like execute_query.
With a session_id, the first page opens a BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY transaction on a pinned connection; subsequent pages reuse
that connection and its snapshot, so rows are not skipped or repeated when the
source table changes between pages. Release the snapshot with release_session
(ROLLBACK). Without a session_id, the read is one-shot and not a snapshot,
and returns at most limit rows (no byte budget). limit defaults to 1000
and is clamped to 1..MAX_PAGE_SIZE; a negative or non-integer limit is
rejected with -32602 instead of falling back to the default.
With a session_id, a single response is bounded by a 16 MB byte budget
(MAX_RESPONSE_BYTES): a page is fetched from the cursor in one FETCH FORWARD and rows are accumulated until adding the next would exceed the
budget, at which point the over-budget row and the rest are rewound (MOVE BACKWARD) for the next page and
has_more reports true. A single row larger than the budget still goes
out as its own response — at least one row is always returned. The budget
keeps a page of large bytea values from producing a response larger than
either side should hold in memory; it applies to the cursor path only, not
the one-shot path. The host should loop on has_more alone (not on
rows.len() < limit), since a page can be short by design when the budget
is hit.
insert_records is the batch typed insert for the write side. It takes a
table, an optional schema, and a rows array of {column: value, ...}
objects (the host builds them from a read_rows result set). It reuses the
type-aware bind_pg_value cascade with column types discovered once per batch,
in one transaction on a one-shot connection (BEGIN → chunked INSERTs →
COMMIT, ROLLBACK on any error), so a batch that fails writes none of its
rows. The column list is derived from the first row's keys; every row must have
the same keys (a row missing a column is an error, not a silent NULL). The
BLOB:...:base64 format from read_rows round-trips through
bind_pg_value's decode_blob_wire_format, so a PG→PG copy preserves every
value — bytea, full-precision timestamps, numeric, etc.
A value that no earlier step of the cascade recognizes (an array with explicit
lower bounds, a composite, a range, hstore text, …) is bound as text and cast
to the column's schema-qualified type, CAST($N AS public.point2d), so the
text read_rows returns for it is parsed by the target's own input function.
A known text column takes its value as is: no shape-based guess (a UUID-shaped
hash, a JSON-array-shaped string, POINT(…), ST_…(…)) applies to it. A
bytea column takes only the BLOB: wire format; any other string is an
error. A jsonb[] array may contain JSON objects; each one is written as its
JSON text.
- Rust (edition 2021)
just(optional, wraps the common cargo invocations)- A running PostgreSQL instance (for integration tests)
just build # debug build
just release # release build (what the GitHub Actions workflow ships)Or directly with cargo:
cargo build --releaseThe binary will be located at target/release/postgresql-plugin.
just dev-install # build + copy binary and manifest into the Tabularis plugins dir
just uninstall # remove the installed pluginjust demo-db # postgres:16-alpine in Docker (postgres / password / testdb)
just demo-db-stopjust test # cargo test — unit tests for SQL builders, parsing, RPC
just lint # clippy -D warnings
just fmt # cargo fmt --allCI runs the live tests against one plain PostgreSQL on 127.0.0.1:54320. The
ones that need TLS, mutual TLS, PgBouncer (transaction and session mode) or a
Unix socket live in client_live_tests::podman and are skipped there.
tests/podman/env.sh starts what they need (podman containers named ro-*,
plus a native PostgreSQL for the socket, because a container's socket does not
cross the podman VM on macOS) and prints the environment variables to export:
tests/podman/env.sh up # needs podman, openssl, psql, postgresql@16
eval "$(tests/podman/env.sh env)"
PG_PLUGIN_TEST_HOST=127.0.0.1 PG_PLUGIN_TEST_PORT=54320 \
cargo test --lib client_live_tests -- --ignored --test-threads=1
tests/podman/env.sh downecho '{"jsonrpc":"2.0","method":"test_connection","params":{"params":{"host":"127.0.0.1","port":5432,"username":"postgres","password":"password","database":"testdb"}},"id":1}' \
| ./target/release/postgresql-pluginPR titles must follow Conventional Commits
(type: subject, type(scope): subject, or type!: subject for a breaking
change) — enforced by CI on every PR. Add a BREAKING CHANGE: footer to the
PR description for breaking changes that don't fit cleanly into the title.
Every PR also needs exactly one prerelease:alpha / prerelease:beta /
prerelease:rc / prerelease:stable label, so CI knows which release
channel to target when suggesting the next version. There's no default —
CI fails with a clear error if the label is missing, rather than guessing.
As of 1.0.0-rc.1, new PRs should use prerelease:rc, not
prerelease:beta. This repo tracks a builtin driver that keeps shipping
its own changes (see CLAUDE.md's "Parity gaps beyond SQL text"); waiting
for full parity before calling this release-ready meant an indefinite
beta line chasing a moving target. rc is the checkpoint instead: gaps
discovered after 1.0.0-rc.1 are tracked as issues/patches on the rc
line (rc.2, rc.3, ...) rather than reasons to hold the channel back.
| PR title type | Version impact |
|---|---|
feat |
minor |
fix, refactor, perf |
patch |
docs, style, chore, test, ci, build |
none — no release suggested |
any type with ! or a BREAKING CHANGE: footer |
major |
CI posts a comment on the PR suggesting the next tag/version based on the
title's type and the prerelease:* label — informational only, nothing is
tagged or released automatically (yet). The suggestion updates (and marks
the previous suggestion as outdated) only when the underlying
classification actually changes, not on every edit to the title text.
- Language: Rust (edition 2021)
- Database driver: tokio-postgres + deadpool-postgres
- TLS: rustls via tokio-postgres-rustls
- Serialization: serde + serde_json
- Async runtime: tokio
- Protocol: JSON-RPC 2.0 over stdio
- @aesslinger
Apache-2.0.



