↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / SQLSTATE

58000 — system_error

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.

English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

aliases
Unknown
class name
System Error (errors external to PostgreSQL itself)
condition name
system_error
lang
en
sqlstate
58000

Definition PG 18

58000

At a glance {#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 {#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 {#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 {#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 {#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 {#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.

Related {#related}

57P01, 57P02, XX000

Sources {#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.

Compare versions

SQLSTATE evidence and recorded runtime versions

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "58000 is system_error in SQLSTATE Class 58."
}
claims · resolved-paths
{
  "claim_id": "resolved-paths",
  "limits": "Source confirmation is not natural runtime.",
  "method": "Read the complete backend call site, common exec macro definition/call site, and logging macro definitions.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.0",
    "src.path.1",
    "src.path.2",
    "src.path.3"
  ],
  "statement": "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."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 58000 from 9.2.0; that boundary does not prove exact implementation introduction."
}
messages · message.0
{
  "limits": "",
  "message_id": "message.0",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.0",
    "primary_template": "failed to send signal to postmaster: %m",
    "severity_source": "ERROR",
    "sources": [
      "src.path.0"
    ],
    "sqlstate": "58000"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.0"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "failed to send signal to postmaster:",
      "position": 0,
      "role": "",
      "template": "failed to send signal to postmaster: %m"
    }
  ]
}
messages · message.1
{
  "limits": "",
  "message_id": "message.1",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.1",
    "primary_template": "%s() failed: %m",
    "severity_source": "non-FRONTEND: ereport(LOG) with ERRCODE_SYSTEM_ERROR; FRONTEND: log_error ignores errcodefn and prints to stderr (no backend SQLSTATE protocol)",
    "sources": [
      "src.path.1",
      "src.path.3"
    ],
    "sqlstate": "58000"
  },
  "severity": "non-FRONTEND: ereport(LOG) with ERRCODE_SYSTEM_ERROR; FRONTEND: log_error ignores errcodefn and prints to stderr (no backend SQLSTATE protocol)",
  "sources": [
    "src.path.1",
    "src.path.3"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "() failed:",
      "position": 0,
      "role": "",
      "template": "%s() failed: %m"
    }
  ]
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L444"
}
sources · src.path.0
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/access/transam/xlogfuncs.c",
  "position": 1,
  "sha256": "6373dff222519c8544541eb120eb6e1f3c921d0b7bb2293689c4e5f98b9d41d0",
  "source_id": "src.path.0",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/transam/xlogfuncs.c#L706"
}
sources · src.path.1
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/common/exec.c",
  "position": 2,
  "sha256": "b39dfdb5574510a25441da87c413ea4c4df90188e5666c2d218345e05cc70831",
  "source_id": "src.path.1",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/common/exec.c#L391"
}
sources · src.path.2
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/include/common/logging.h",
  "position": 3,
  "sha256": "ca990bba3381d3810e5e031eb33658e1d48a3654f2cbae3ae5e3c9d4c727b787",
  "source_id": "src.path.2",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/include/common/logging.h#L106"
}
sources · src.path.3
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/common/exec.c",
  "position": 4,
  "sha256": "b39dfdb5574510a25441da87c413ea4c4df90188e5666c2d218345e05cc70831",
  "source_id": "src.path.3",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/common/exec.c#L52"
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:96baad059338afd65de693238551af02f13c0355a81ed17625d1c6a7826eb639

Text language: en · english-manuals:96baad059338afd65de693238551af02f13c0355a81ed17625d1c6a7826eb639