rpc_data_postgres 2.3.0
rpc_data_postgres: ^2.3.0 copied to clipboard
PostgreSQL adapter and repository for rpc_data — CRUD, querying and change streams over a Postgres database.
2.2.0 #
Changed #
- Requires rpc_data 5.1.0, which stops read-only journal calls materialising collection state and keeps the cause on an internal error.
2.1.1 #
- A dropped table no longer fails the OTHER processes that had cached it.
_knownTablesrecords a fact about the database inside one process, anddeleteCollectioncan only evict it where it ran — so with more than one replica the rest keep answering "that table exists" about a table that is gone, and the next statement fails on a name resolving to no relation. 2.1.0 covered the collection that was never cached; this covers the one that was. The cache stays an optimisation but is no longer treated as proof: a statement reporting42P01corrects it and the operation recovers — a read returns no rows, a write recreates the table and retries once.
2.1.0 #
- Collection teardown is one transaction.
deleteCollectiondropped the table and cleared the registry as separate statements — behind aPool, on separate connections — so an interruption between them left a registration pointing at a table that no longer existed. ensureReadyno longer throws on such a registration. It could only be raised at startup, which scoped the damage backwards: one dropped table failed every boot from then on, taking down every other collection with it. The registration is now reported through the newonIntegrityIssuecallback and skipped — the collection reads as empty, and the next write recreates its table.- A read on a collection whose table is gone returns nothing instead of failing on a name that resolves to no relation.
2.0.0 #
Breaking — cursors issued by 1.x are rejected by this version. They are short-lived, so the practical cost is one restarted page walk.
- Pagination cursors are self-contained tokens carrying the boundary
(sort value + id) instead of the boundary record's id. The old cursor was
re-read on the next page, which made paging depend on that row surviving
unchanged: deleting it failed the next page with
invalidArgument, and updating it moved the boundary so rows in between were silently skipped or repeated. Both are covered by tests now. - The keyset tiebreaker is
idrather thanctid. Postgres rewritesctidon every UPDATE and onVACUUM FULL, so it could never anchor an order. - Two queries per page are gone with the re-read (
_cursorExistsand the boundary lookup); full-text search paged the same way and got the same fix. writeRecordsno longer compares against versions read before the upsert. A concurrent writer landing in between made a refused row look like it applied, so the batch reported success for a write it had dropped. The upsert now reports which ids landed (RETURNING id) and only the refused ones are re-read.- Documented what the adapter does not push down:
RecordFilter.containsTermscompiles toLOWER(payload::text) LIKE '%term%', a full scan no index serves. The class comment previously claimed the opposite — that queries were materialised in Dart — which had not been true for some time. - Tests take the connection URL from
RPC_PG_URL, so they can run against a throwaway instance instead of whatever holds the default port.
4.0.0 #
- Initial extraction from
rpc_datawith PostgreSQL JSONB adapter and repository.