Skip to content

exit_on_error

exit_on_error — Terminate session on any error. Observed in PG9.1–19 Beta 3; its last measured boot default is off in PG19 Beta 3, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Terminate session on any error.”

Identity

Type , Valuebool
Upstream pg_settings type
Context , Valueuser
Settable by an ordinary user
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueError Handling
Upstream classification
Latest boot value , Valueoff
off

Lifecycle

Fact Value
First observed PG9.1
Present in PG9.1–19 Beta 3
Removed in No
Introduction commit Not asserted: the name already exists at the 2008 Git-history boundary
Commit date ≤ 2008-01-01
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.1–19 Beta 3 off off

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.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
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.
OLAP Test separately under long queries, batch jobs, and peak concurrency rather than copying OLTP assumptions to analytical nodes.
Small nodes Keep the default without a concrete problem; small systems should not trade global compatibility or failure semantics for a marginal gain.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.1–19 Beta 3 unmodified; OLAP: PG9.1–19 Beta 3 unmodified; CRIT: PG9.1–19 Beta 3 unmodified; TINY: PG9.1–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • 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.

restart_after_crash · statement_timeout · idle_in_transaction_session_timeout · data_sync_retry · recovery_init_sync_method

References