Skip to content

Limitations

These are the limits I know about. Each one is a design decision or an assumption, not a bug waiting to be fixed quietly.

The translator handles exactly the statements chord 1.7.0’s store generates. A chord release that generates a new construct makes this package throw UnsupportedSqlError rather than mis-write. That is the maintenance contract, and it is why the peer range is pinned to a tested one.

The same holds for SQL you write yourself: DDL passed through exec may work, but only the constructs chord emits have a rule and a case behind them.

chord assumes one writer per session: two openPostgresStore calls on one schema do not corrupt each other’s rows (the advisory lock serialises them), but their in-memory lastSeq/id-allocator state is each store’s own, so their metadata row is last-writer-wins.

Use one store per schema, and open several storages on it instead (StoreStorage.open(store, owner, context) from @earendil-works/pi-durable/storage/store).

A database whose server encoding is not UTF-8 cannot be used: the COLLATE "C" order that chord depends on would not match its code-point comparison. Postgres’ default (UTF8) is fine, and the store’s own open fails on anything else rather than running with a comparison order it cannot honour.

It is set by the adapter’s DDL. A column added to a chord store by something else — hand-written ALTER TABLE, a migration of a host’s own — will not have it, and text in that column will compare in the database’s default collation.

The corollary of the two points above: chord’s compareText and prefixUpperBound assume code-point order, which COLLATE "C" gives for UTF-8. A case-insensitive collation, or a locale one, would reorder rows and break a prefix() range.

Postgres truncates a longer identifier silently, which would merge two tables, so the adapter refuses it. A longer owner name or table name fails at declaration: for pi-durable, owner is capped at 38 characters, because the longest name it declares is <owner>:entries:conversation.

Nested transaction calls hang unless they use the handle

Section titled “Nested transaction calls hang unless they use the handle”

Calling the database from inside its own transaction rejects with ClosedError instead of queueing behind itself, which is a deviation from the contract’s description and a deliberate one — a clear error beats a hang. Nested work goes through the transaction handle the callback is given.

A lost connection is permanent for that database object

Section titled “A lost connection is permanent for that database object”

There is no transparent reconnect. After ConnectionLostError the object is done: close it and open a new one. A commit whose connection died may or may not have committed, and the store’s in-memory id allocator would not know.

pg is a peer of your process, not of this package

Section titled “pg is a peer of your process, not of this package”

pg is a normal dependency here, but Node resolves one copy per process where it matters: if your host already installs a different pg major, check it against this package’s dependencies range. A Pool you pass in is your pg’s, and the type guards are structural, so a mismatched major can compile and still behave differently.

  • No migration tool of its own: the store’s schema evolves through chord’s evolveTable, and this package adds nothing on top of it.
  • No pooling beyond one pg pool per database object, and no read replicas.
  • No listener/notification support, no logical replication hooks.
  • No claim about Postgres 15 or older. The suites run on 16 through 19, so that range is what is tested; anything below it is unverified rather than forbidden.