Skip to content

postgresStore

postgresStore(options): Store

Defined in: store/postgres.ts:178

Creates a Postgres store over your pool. It returns synchronously, so it can go straight into createServer({ store }); the tables are created before the first operation runs (see migratePostgres).

appendLog is one INSERT ... SELECT that writes the whole batch only if its first seq is the stored last seq plus one, so a batch is atomic, gaps are rejected, and of two concurrent writers of the same seq exactly one wins (the other hits the primary key). When nothing was written, a batch whose entries are all stored with identical data succeeds (a retried write, including one that raced an identical write); any other batch rejects with a StoreConflictError.

close() waits for the store's queries in flight, then rejects further calls. It does not end the pool.

PostgresStoreOptions

Store