Diagnostic Queries
Symptoms
A configuration parameter could not be changed at this moment because of the current context (for example, it can only change at the start of a transaction or session). PostgreSQL raises SQLSTATE 55P02 (cant_change_runtime_param).
- The parameter is settable, but not in the present state.
- Some parameters only change before any query in a transaction.
- Distinct from restart-only parameters.
What the server log shows
ERROR: parameter "transaction_isolation" cannot be changed now
Why PostgreSQL raises this — what the manual says
As Section 19.1 Setting Parameters explains:
Some parameters take effect only in a specific context (for example only at the start of a session or before a transaction begins); attempting to change such a parameter at the wrong moment fails because it cannot be applied now.
Certain parameters are constrained by context (transaction-start only, etc.). When you try to change one outside the permitted window, PostgreSQL rejects it with 55P02.
Common causes
- Changing a transaction-scoped parameter after a query has run.
- Setting a parameter that is fixed for the current operation.
- Issuing SET at the wrong point in a transaction.
How to fix it
- Issue the SET at the right time (e.g. immediately after
BEGIN). - Use the dedicated syntax (e.g.
BEGIN TRANSACTION ISOLATION LEVEL …). - Set it at session start or via
postgresql.confif it must be global.
Related & next steps
Reference: PostgreSQL 18 Section 20.1 “Setting Parameters”.
Thanks — noted. This helps keep the database accurate.