select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 58 · SYSTEM ERROR (ERRORS EXTERNAL TO POSTGRESQL ITSELF)

system_error

SQLSTATE
58000
Condition name
system_error
Class
System Error (errors external to PostgreSQL itself)
Source macro
ERRCODE_SYSTEM_ERROR
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>58000</h1>

At a glance

58000 is the system-error condition. In the fixed backend path, pg_promote creates the promotion signal file and then calls kill(PostmasterPid, SIGUSR1); a failed signal reports ERROR with the operating-system text substituted for %m.

Meaning

The representative backend primary is exactly failed to send signal to postmaster: %m. The code unlinks the promotion signal file before raising ERROR, so the failed system call is part of a postmaster-notification path, not a user value or SQL syntax failure. The shared common/exec.c source uses a log_error macro that has two compile-time branches. In a non-FRONTEND build it expands to ereport(LOG, (errcodefn, errmsg_internal(...))); in a FRONTEND build it ignores the errcode() argument and prints the formatted text to stderr. Thus the frontend utility message is not proof of a client-protocol 58000 diagnostic or a client transaction abort. The separate pg_log_error macro in common/logging.h maps to PG_LOG_ERROR, but pclose_check() does not call that macro.

Messages

  • Backend pg_promote signal path: primary failed to send signal to postmaster: %m, severity ERROR. The expanded text depends on the OS errno at the failed kill() call.
  • Shared pclose_check() source: the call-site template is %s() failed: %m; with pclose() it expands to pclose() failed: <OS text>. Non-FRONTEND builds log it through ereport(LOG) with the supplied ERRCODE_SYSTEM_ERROR; FRONTEND builds ignore that code and print to stderr, so this is not a client-protocol 58000 path.

Diagnosis

Preserve the full primary after %m expansion, the operation (promotion signal, pclose, or another system helper), process identity, and server or utility log context. For backend pg_promote, inspect the postmaster PID, signal permissions/process liveness, and the OS error. Do not replace the OS-specific cause with a generic disk, permission, or process diagnosis without the actual errno. The SQLSTATE alone does not establish transaction outcome.

Response

Correct the operating-system condition identified by the expanded message, then verify postmaster/server health before retrying the operation. A backend ERROR normally aborts the current explicit transaction, so send ROLLBACK or ROLLBACK TO SAVEPOINT before continuing; in autocommit, retry only after the cause is fixed. A frontend log from pclose_check has its utility's own control flow and does not call for a SQL transaction rollback. If the connection was lost, reconnect after readiness and verify business effects.

Versions

The locked catalogue records this condition from 9.2.0; that boundary does not prove the exact implementation-introduction version. Fixed source coverage is PostgreSQL 18.6.

Sources

src/backend/access/transam/xlogfuncs.c#L702-708

src/common/exec.c#L52-70

src/common/exec.c#L391-412

src/include/common/logging.h#L106-110

The structured evidence record records the backend and frontend/common message boundaries.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

58000 is system_error in SQLSTATE Class 58.

Method: Read fixed definition.

src.errcodes.18.6

The fixed backend pg_promote path reports ERROR with ERRCODE_SYSTEM_ERROR; the shared pclose_check source has separate non-FRONTEND ereport(LOG) and FRONTEND stderr macro branches, so frontend output is not asserted as a client-protocol 58000 response.

Method: Read the complete backend call site, common exec macro definition/call site, and logging macro definitions.

Limits: Source confirmation is not natural runtime.

src.path.0 src.path.1 src.path.2 src.path.3

The locked catalogue records 58000 from 9.2.0; that boundary does not prove exact implementation introduction.

Method: Use catalogue boundary.

src.errcodes.18.6

Message templates

ERROR · message.0

Primary

failed to send signal to postmaster: %m
non-FRONTEND: ereport(LOG) with ERRCODE_SYSTEM_ERROR; FRONTEND: log_error ignores errcodefn and prints to stderr (no backend SQLSTATE protocol) · message.1

Primary

%s() failed: %m

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Version history 1
  1. PG 9.1 → 9.2added

Definition snapshot: english-manuals:0a733e8ed7893330611d0819206… · English manual source