select open change scope Open full search

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

SQLSTATE / CLASS 01 · WARNING

warning

SQLSTATE
01000
Condition name
warning
Class
Warning
Source macro
ERRCODE_WARNING
Evidence
Observed at runtime in the source evidence
Analysis & operational context

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

At a glance

01000 is the generic warning condition in Class 01, Warning. It is a directory classification, not a description of one particular subsystem or message. PostgreSQL's source directory explicitly says not to use this class for failure conditions.

The five-character code must be read together with the protocol severity and the complete diagnostic. In an ErrorResponse or NoticeResponse, S is the possibly localized severity and V is the nonlocalized severity. A message can therefore arrive as WARNING, NOTICE, INFO, or another notice level while its SQLSTATE is still 01000 when the emitting code supplied that code explicitly.

For the common default path, PostgreSQL maps ereport(WARNING, ...) to 01000, levels at or above ERROR to XX000, and lower levels to 00000. An explicit errcode() can override that default. This is why the directory's W marker is useful, but it does not by itself prove that the wire message was an actual WARNING.

The representative generic_warning_boundary probe passed on PostgreSQL 18.6 and 10.21. It uses PL/pgSQL RAISE WARNING to verify the default 01000 dispatch, receives an actual WARNING notice, and keeps the autocommit connection usable. It does not exercise the asynchronous NOTIFY, hstore, XID, or MultiXact warning paths.

The locked catalogue has a pre-9.0 presence observation at PostgreSQL 7.4 and records 01000 in every listed formal snapshot from 9.0.23 through 18.6 plus the 19 Beta 3 preview. The pre-9.0 source scan covers 7.4 through 8.4.22; candidate source gaps remain for 7.0 through 7.3. This is a known presence boundary, not an exact introduction version.

Meaning and trigger paths

The locked 18.6 definition is 01000 W ERRCODE_WARNING warning under Class 01. The default severity mapping is in elog.c: an ERROR or higher level starts with ERRCODE_INTERNAL_ERROR, a WARNING level starts with ERRCODE_WARNING, and lower levels start with ERRCODE_SUCCESSFUL_COMPLETION. The later error construction can replace that initial code.

Several real paths use the generic warning code:

  • The asynchronous notification queue reports NOTIFY queue is %.0f%% full. When an old listener transaction is identified, it adds a detail naming the PID and a hint to end that transaction. This is a queue pressure warning, not an array, privilege, or constraint failure.
  • Transaction ID and MultiXact wraparound protection reports that a database must be vacuumed within a remaining number of transactions or MultiXact IDs. Its hints point to a database-wide VACUUM and to old prepared transactions or stale replication slots.
  • The SPI cleanup path explicitly supplies ERRCODE_WARNING for a non-empty SPI stack and points to missing SPI_finish calls. Here the code is explicit even though the severity is also WARNING.

These source-confirmed examples show why the message, detail, hint, source context, and operation are more actionable than 01000 alone. Other Class 01 conditions, such as 01003 or 0100C, have their own SQLSTATEs and should not be collapsed into this generic code.

Messages and diagnostics

The executable representative is the registry entry generic_warning_boundary:

DO $$ BEGIN RAISE WARNING 'calibration warning'; END $$;
SELECT 1;

Both PostgreSQL 18.6 and 10.21 delivered the warning through the notice channel with SQLSTATE 01000, severity WARNING, and primary message calibration warning. The follow-up SELECT 1 succeeded and the connection was IDLE. This is a real RAISE WARNING dispatch check; it is not runtime evidence for the separate NOTIFY queue, hstore compatibility, transaction-ID, or MultiXact paths listed above.

Diagnosis

Capture C/sqlstate, S, V, M, D, and H from the driver or protocol, together with the statement, database, backend PID, and timestamp. In a client library with a notice handler, record notices as well as exceptions: a warning-level NoticeResponse can be delivered without raising a statement exception. Keep the original localized message and the nonlocalized severity when available.

Check SHOW client_min_messages and SHOW log_min_messages when a message is missing from the client or server log. Those settings control delivery and logging thresholds; they do not change the underlying cause. For a repeated warning, search logs by SQLSTATE and the stable message template, then inspect the named subsystem:

  • NOTIFY queue ... full calls for long-lived listener transactions and the PID in DETAIL.
  • XID or MultiXact vacuum warnings call for transaction age, prepared transactions, and replication slots before wraparound protection becomes an actual failure.
  • A non-empty SPI stack points toward extension or server-side SPI lifecycle handling.

Do not infer a transaction abort, a broken connection, or data corruption from 01000 alone. The representative warning left its session usable, but a later statement may fail for an independent reason, and a function or client operation may impose its own control flow.

Response

Treat the message's subsystem and hint as the repair target. End or repair the transaction that is holding a notification queue or old transaction horizon; perform the indicated database-wide maintenance after checking replication slots and prepared transactions; or fix the extension's SPI ownership. Preserve the original diagnostic while investigating.

An actual WARNING or lower-level notice does not by itself put an explicit transaction into the aborted state, and it normally leaves the connection able to continue. Verify the next command and transaction status instead of assuming either outcome from the code. If a subsequent ERROR occurs, handle that error's SQLSTATE and recover with ROLLBACK or a suitable savepoint according to that error's contract.

Raising client_min_messages or log_min_messages can reduce noise, but it does not repair the queue, transaction horizon, or SPI lifecycle. Use suppression only after the underlying signal has been understood.

Versions

The catalogue records 01000 in the locked 7.4–8.4.22 pre-9.0 formal sources and in all formal catalogue snapshots from 9.0.23 through 18.6, plus 19 Beta 3. The same-tag REL8_1_4 errcodes.sgml table already lists the older 1000 spelling with condition name warning, so this condition-name observation is confirmed by 8.1.4. Candidate source gaps remain for 7.0–7.3, so the 7.4 observation is a presence boundary rather than an exact introduction version. The 18.6 source snapshot is fixed at commit 724edf9bde9d356724ad384a2e196edc3c9f80f7.

The protocol severity fields and the client_min_messages/log_min_messages controls are documented for PostgreSQL 18. The representative source paths above are 18.6 observations; their presence does not claim that every message template is unchanged in every older release.

Sources

The structured evidence for this page is recorded in the public evidence JSON. The source and documentation records use fixed PostgreSQL commit 724edf9bde9d356724ad384a2e196edc3c9f80f7; runtime records retain the exact snippet registry and run IDs for the passed probe.

Source evidence

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

01000 is the generic warning condition in Class 01, and the directory comment says not to use Class 01 for failure conditions.

Method: Read the Class 01 section and the 01000 row in the frozen errcodes.txt snapshot.

Limits: Directory identity does not identify the emitting subsystem or prove a runtime occurrence.

src.errcodes.18.6

Without a later explicit errcode, PostgreSQL initializes ERROR and higher levels as XX000, WARNING as 01000, and lower levels as 00000.

Method: Read the default sqlerrcode selection in errstart() in the fixed 18.6 source.

Limits: An explicit errcode in the ereport construction can replace this initial value; the mapping does not classify every notice by message text.

src.elog.18.6

The asynchronous notification queue emits a WARNING with SQLSTATE 01000 by default when its usage reaches the warning path, with conditional PID detail and a hint to end the oldest transaction.

Method: Read asyncQueueFillWarning() and its ereport(WARNING) construction.

Limits: The warning is rate-limited and conditional on queue usage and an identifiable old listener; the source path is not a promise that every installation will observe it.

src.async.18.6

Transaction ID and MultiXact horizon checks emit warning messages and maintenance hints for a database approaching its configured horizon.

Method: Read the ereport(WARNING) branches and their VACUUM, prepared-transaction, and replication-slot hints.

Limits: These are source-confirmed paths; their conditions and remaining-count values depend on live transaction state.

src.varsup.18.6 src.multixact.18.6

The SPI cleanup path explicitly supplies ERRCODE_WARNING for a non-empty SPI stack and reports a missing SPI_finish hint.

Method: Read the commit cleanup branch at lines 467-472 in the fixed source.

Limits: This warning requires an SPI lifecycle defect; it is not a generic SQL warning trigger.

src.spi.18.6

The protocol carries localized S and nonlocalized V severity fields; error messages use ERROR/FATAL/PANIC while notice messages can use WARNING, NOTICE, DEBUG, INFO, or LOG.

Method: Read the official Error and Notice Message Fields table in the PostgreSQL 18 documentation.

Limits: The fields describe the wire message; they do not change the SQLSTATE directory row.

doc.protocol.18

client_min_messages and log_min_messages control which messages are delivered to clients or written to the server log.

Method: Read the PostgreSQL 18 runtime logging configuration entries.

Limits: Thresholds affect visibility, not the underlying emitting condition, and configuration can differ between sessions and servers.

doc.logging.18

The catalogue records 01000 in the locked 7.4–8.4.22 pre-9.0 formal sources and every listed formal snapshot from 9.0.23 through 18.6 and 19beta3. The same-tag REL8_1_4 errcodes.sgml row already lists the older 1000 spelling with condition name warning, confirming that condition-name observation by 8.1.4. Candidate source gaps remain for 7.0–7.3, so 7.4 is a presence boundary rather than an exact introduction version.

Method: Read the manifest snapshots and the same-tag REL8_1_4 errcodes.sgml row for the 01000 definition; the per-code history file is a derived view of these locked records.

Limits: The pre-9.0 source set is locked through 8.4.22 but candidate source gaps remain for 7.0–7.3; observed presence is not an asserted introduction version.

manifest.01000 doc.errcodes.8.1.4

The generic_warning_boundary case delivered an observed WARNING with SQLSTATE 01000 and the calibration warning message on PostgreSQL 18.6 and 10.21; the autocommit connection remained IDLE and accepted SELECT 1.

Method: Read the stable case and ordered snippet registry, then compare the warning notice, SQLSTATE, severity, followup, and IDLE status in both final run summaries and raw records.

Limits: This runtime result covers the PL/pgSQL RAISE WARNING dispatch probe only; it is not runtime evidence for the separate NOTIFY queue, hstore, XID, or MultiXact paths.

case-manifest.01000 snippet-registry.01000.final runtime.01000-warning-dispatch-final-20260909.latest runtime.01000-warning-dispatch-final-20260909.pg10

Message templates

default_by_severity WARNING · message.notify-queue

Primary

NOTIFY queue is %.0f%% full

Detail

The server process with PID %d is among those with the oldest transactions.

Hint

The NOTIFY queue cannot be emptied until that process ends its current transaction.

DETAIL and HINT are conditional on finding an oldest listener process.

default_by_severity WARNING · message.xid-wraparound

Primary

database "%s" must be vacuumed within %u transactions

Hint

To avoid transaction ID assignment failures, execute a database-wide VACUUM in that database.
You might also need to commit or roll back old prepared transactions, or drop stale replication slots.

The remaining count and optional follow-up text are calculated from live transaction state.

default_by_severity WARNING · message.multixact-wraparound

Primary

database "%s" must be vacuumed before %u more MultiXactId is used

Primary

database "%s" must be vacuumed before %u more MultiXactIds are used

Hint

Execute a database-wide VACUUM in that database.
You might also need to commit or roll back old prepared transactions.

The singular/plural selection and remaining count depend on live MultiXact state.

explicit ERRCODE_WARNING at WARNING · message.spi-stack

Primary

transaction left non-empty SPI stack

Hint

Check for missing "SPI_finish" calls.

This template belongs to SPI cleanup and does not describe every 01000 path.

observed WARNING notice · message.runtime-warning

Primary

calibration warning

This message is supplied by the representative probe and is not a built-in template for the NOTIFY, hstore, XID, or MultiXact paths.

Reproduction & repair cases

generic_warning_boundary · PG 10, 18

Preconditions

  • A disposable session with a notice handler

Trigger: Execute a PL/pgSQL RAISE WARNING dispatch probe.

Expected assertions

  • The notice handler receives SQLSTATE 01000 and WARNING severity
  • The warning message is preserved
  • The session remains IDLE and a follow-up query succeeds
  • The probe is not presented as the hstore_compat.c natural warning path

Repair: Treat the warning's message and context as the actionable signal; identify the emitting subsystem before changing data.

Cleanup: No persistent runtime resources are created.

Recorded runtime evidence

18.6 (Homebrew) · passed

Run: 01000-warning-dispatch-final-20260909

The run verifies default RAISE WARNING dispatch, not the separate NOTIFY queue, hstore, XID, or MultiXact warning paths.

{
  "scope": "PL/pgSQL RAISE WARNING dispatch probe; does not represent the hstore_compat.c warning path",
  "followup": 1,
  "severity": "WARNING",
  "sqlstate": "01000",
  "message_primary": "calibration warning",
  "status_after_probe": "IDLE"
}
10.21 (Debian 10.21-1.pgdg90+1) · passed

Run: 01000-warning-dispatch-final-20260909

The run verifies default RAISE WARNING dispatch, not the separate NOTIFY queue, hstore, XID, or MultiXact warning paths.

{
  "scope": "PL/pgSQL RAISE WARNING dispatch probe; does not represent the hstore_compat.c warning path",
  "followup": 1,
  "severity": "WARNING",
  "sqlstate": "01000",
  "message_primary": "calibration warning",
  "status_after_probe": "IDLE"
}

Definition snapshot: english-manuals:812224784659c0be9e6a013bafe… · English manual source