Skip to content

Feature parity gap: lossless row read/write for host table-to-table copy #207

Done

Description

@aesslinger

Missing feature

A lossless row-read and row-write path for host-driven table-to-table copy: either typed/text-cast reads plus a typed batch insert, or an equivalent optional RPC pair, so Tabularis can copy tables with PostgreSQL as a source and as a target without losing data.

Plugin version

v1.0.0-rc.14 (src/extract.rs, src/utils/blob.rs, src/rpc.rs at that tag)

Tabularis app version

0.33.1 (affects the build from TabularisDB/tabularis#1625, which removes the built-in PostgreSQL driver)

Additional context

Behavior change. On main Tabularis offers Transfer table from a PostgreSQL connection with two destinations: PostgreSQL and SQLite. That was a host-side path inside the built-in driver. It read the source through a REPEATABLE READ, read-only transaction with a cursor, selected non-trivial types as text, and wrote through typed binds, so every conversion was exact or was refused before anything was written.

With the built-in driver gone, the host has no PostgreSQL code to do that. The feature is hidden for postgresql connections: the host advertises only SQLite to SQLite, because a copy built on the plugin's current read format cannot meet the "reject any lossy conversion" rule that the table transfer was reviewed against.

Why the current RPCs cannot carry a lossless copy. execute_query returns values formatted for display. Checked in extract.rs at rc.14 and against a real PostgreSQL:

Type What execute_query returns Effect on a copy
TIMESTAMP, TIMESTAMPTZ formatted %Y-%m-%d %H:%M:%S (extract.rs:92-97) fractional seconds are dropped, and for timestamptz the offset is dropped. 2026-11-26 10:11:12.345678+05 reads back as 2026-11-26 05:11:12.
BYTEA BLOB:<size>:<mime>:<base64 of the first 10,240 bytes> (utils/blob.rs, MAX_BLOB_PREVIEW_SIZE = 10_240) values over 10 KB are truncated; the header keeps the true size, the data does not.
NUMERIC, int*, float8 exact (decimal string, native numbers) fine
arrays, ranges, other special types strings fidelity depends on the type

There is no bulk read or typed read in the RPC surface. fetch_blob_as_data_url / save_blob_to_file return a full blob, but only one cell at a time by primary key. insert_record writes one row from a JSON map, so a copy would be one RPC per row, with no typed binding contract.

What is needed (plugin side). The exact shape is the maintainers' call. Any of these would work, as long as the copy is lossless:

  1. A copy-grade read. For example an optional read_rows / execute_query mode (a typed or text flag) that returns each value in a lossless, round-trip form: timestamps with full precision and offset, bytea in full (not the 10 KB preview), numerics as exact text, and the PostgreSQL type name per column so the host can plan the conversion.
  2. A batch typed insert. An optional RPC taking a batch of rows plus column types and binding them with the correct PostgreSQL types (not JSON strings), inside one transaction per batch, so a failed batch writes nothing.
  3. A snapshot for the read. The built-in path read the whole table from one REPEATABLE READ snapshot. A paged read re-runs a statement per page, so rows can be skipped or repeated if the table changes between pages. Either keep one pinned snapshot across pages (a session-pinned REPEATABLE READ transaction) or document that the read is not a snapshot.
  4. A capability flag for the host to key on. Tabularis's rules (.rules/plugins.md) require capability-driven logic, not driver-id checks, so the host needs something like table_copy in the manifest to decide that PostgreSQL may appear as a source and target.

Suggested acceptance criteria.

  • A table with timestamp(6), timestamptz, bytea over 10 KB, numeric(38,10), int8, float8, bool, text and uuid columns copies PostgreSQL to PostgreSQL and PostgreSQL to SQLite with every value identical to the source (or the copy is refused before any row is written).
  • A batch that fails writes none of its rows.
  • A table that changes during the read is either copied from one consistent snapshot or the limitation is documented.

Related. TabularisDB/tabularis#1625 (review feedback asking to keep PostgreSQL and SQLite copy destinations for PostgreSQL users). Sibling parity gaps: #201 (transactional SQL import), #202 (read-only queries).

Metadata

Metadata

Assignees

No one assigned

    Labels

    capability-gap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions