Repository navigation
Description
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:
- A copy-grade read. For example an optional
read_rows/execute_querymode (atypedortextflag) that returns each value in a lossless, round-trip form: timestamps with full precision and offset,byteain full (not the 10 KB preview), numerics as exact text, and the PostgreSQL type name per column so the host can plan the conversion. - 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.
- A snapshot for the read. The built-in path read the whole table from one
REPEATABLE READsnapshot. 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-pinnedREPEATABLE READtransaction) or document that the read is not a snapshot. - 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 liketable_copyin the manifest to decide that PostgreSQL may appear as a source and target.
Suggested acceptance criteria.
- A table with
timestamp(6),timestamptz,byteaover 10 KB,numeric(38,10),int8,float8,bool,textanduuidcolumns 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).
Activity
feat: add batch typed insert_records for the table-copy write side (#207
fix: close review findings on lossless table-copy (#207)
fix: reject rows with extra keys not in rows[0] (#207)
feat: add lossless read_rows RPC for table-to-table copy (#207) (#211)
chore: release 1.0.0-rc.15 (#213)