exit_on_error
Read PG 18 manual ↗If on, any error will terminate the current session.
- Type
- bool
- Context
- user
- Measured default
- off
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
If on, any error will terminate the current session. By default, this is set to off, so that only FATAL errors will terminate the session.
Measured default history
| Version interval | Default |
|---|---|
| 9.1 – 19 | off |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
The exit_on_error name already exists in PostgreSQL's GUC table at this project's 2008 Git-history boundary and in the PG9.0 source. PG9.0 marks it GUC_NO_SHOW_ALL, so it is absent from that version's pg_settings snapshot; first observation in PG9.1 is a visibility change, not a claim that the underlying behavior was invented in PG9.1.
When enabled, an error terminates the backend session after normal error processing, not merely the current transaction. It differs from client-side stop-on-error behavior such as psql's ON_ERROR_STOP and can discard session-local state, prepared statements, temporary objects, and an application's connection unexpectedly.
Because it has user context, a controlled session can test the policy without changing every connection. Treat it together with restart_after_crash, transaction error handling, pooler retry behavior, statement_timeout, and idle_in_transaction_session_timeout; server termination is not a substitute for correct transaction recovery.
Operational considerations
Confusing the boot default of exit_on_error with its current effective value.
Ignoring its user context when deciding when it takes effect.
Changing several interacting settings at once and losing causal evidence.
Rolling out globally without testing the real failure or workload boundary.
Workload guidance
OLAP: Test separately under long queries, batch jobs, and peak concurrency rather than copying OLTP assumptions to analytical nodes.
OLTP: Change exit_on_error only from an explicit failure model and measured evidence. Validate in a session/test environment, deploy according to its context, and retain a rollback value.
SMALL: Keep the default without a concrete problem; small systems should not trade global compatibility or failure semantics for a marginal gain.
Version history 2
- PG 11 → 12changed
- PG 9.0 → 9.1added
Related entries
Further reading
Definition snapshot: english-manuals:ac64952fe3a8210e066780c97b0… · English manual source