@@ -16,14 +16,18 @@ const READ_STATEMENT_TIMEOUT_MS = 15_000
1616const READ_LOCK_TIMEOUT_MS = 3_000
1717
1818/**
19- * Applies every guard in ONE round-trip. Each `trx.execute` is its own serial round-trip (the
20- * driver runs `prepare: false`), and every user-table read opens a transaction, so issuing these
21- * separately cost 2–3 round-trips on every page, count, and drain batch.
19+ * Applies every guard in ONE round-trip. Each awaited `trx.execute` is its own round-trip, and
20+ * every user-table read opens a transaction, so issuing these separately cost 2–3 round-trips on
21+ * every page, count, and drain batch.
2222 *
2323 * `set_config(name, value, is_local => true)` is exactly `SET LOCAL` — transaction-scoped, dying
24- * with the commit — but it is a function call, so several fit in a single `SELECT`. Semicolon-
25- * joining `SET LOCAL` statements would not work here: the driver sends this over the extended
26- * protocol, which rejects multiple commands in one message.
24+ * with the commit, and reverting the same way on a savepoint rollback — but it is a function call,
25+ * so several fit in one `SELECT`. It also takes the values as bound parameters, which `SET LOCAL`
26+ * cannot. That is the reason they must be one statement rather than semicolon-joined: a bound
27+ * parameter forces the extended protocol, which rejects multiple commands per message.
28+ *
29+ * The guards are the first statement in the transaction, so an invalid value aborts it before
30+ * `fn(trx)` can run — there is no path where a read proceeds unguarded.
2731 */
2832async function setReadGuards ( trx : DbTransaction , seqscanOff : boolean ) : Promise < void > {
2933 /**
0 commit comments