P0003 — too_many_rows
P0003
At a glance
P0003 is PL/pgSQL too_many_rows. Fixed paths preserve the message, optional parameter detail, hint, and the source-selected severity boundary.
| Field | Value |
|---|---|
| SQLSTATE | P0003 |
| Condition | too_many_rows |
| Status | active |
| Known present by | 8.2.0 |
| Locked snapshots | 9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3 |
| Macros | ERRCODE_TOO_MANY_ROWS |
| Aliases | — |
Meaning
A fixed PL/pgSQL path reports query returned more than one row; the strict path may attach parameters: %s detail and the source-provided hint Make sure the query returns a single row, or use LIMIT 1.. The actual severity is branch-dependent.
Diagnosis
Check the strict or modifying-statement path and preserve the actual severity: plpgsql.extra_errors selecting too_many_rows takes precedence and makes the extra check ERROR; otherwise plpgsql.extra_warnings selecting it makes the extra check WARNING. Strict or modifying-statement paths use ERROR regardless of those settings. Ordinary multi-row SELECT behavior is not automatically P0003.
Response
Make the query satisfy the single-row contract or deliberately choose a multi-row structure; do not blindly replay business work.
Versions
The locked catalogue records this condition from 8.2.0 in the listed formal snapshots and 19beta3; fixed source coverage is PostgreSQL 18.6.
Related
Sources
See the fixed pl_exec.c GUC branch and report paths alongside the structured evidence record.