Notes for extension authors

  • pgrx’s SpiClient::update assigns a transaction id before running anything (it calls GetCurrentTransactionId() to mark the transaction mutable). A transaction with an id writes a commit record, and a durable commit record is an fsync. The first version of this extension used it for internal reads: every discover paid a flush, and the question “did this transaction already write?” answered itself yes by being asked. Reads here go through SpiClient::select; that question is asked with GetTopTransactionIdIfAny().
  • CREATE EXTENSION does not grant USAGE on the extension’s schema. An agent could not even propose until the script granted it.