# 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 {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `bool` | Upstream pg_settings type |
| Context | `user` | Settable by an ordinary user |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Error Handling | Upstream classification |
| Latest boot value | `off` | off |
{.fields meta="-"}

## Lifecycle {#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 {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.1–19 Beta 3 | `off` | — | off |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

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 {#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. |
{.full-width}

## Pigsty {#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 | — | — |
{.full-width}

> [!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 {#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.

## Related parameters {#related-parameters}

[`restart_after_crash`](/parameters/restart-after-crash/) · [`statement_timeout`](/parameters/statement-timeout/) · [`idle_in_transaction_session_timeout`](/parameters/idle-in-transaction-session-timeout/) · [`data_sync_retry`](/parameters/data-sync-retry/) · [`recovery_init_sync_method`](/parameters/recovery-init-sync-method/)

## References {#references}

- [PostgreSQL 19 Beta 3 — exit_on_error](https://www.postgresql.org/docs/19/runtime-config-error-handling.html#GUC-EXIT-ON-ERROR)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
