Todo item: Include the symbolic SQLSTATE name in verbose error reports

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Todo item: Include the symbolic SQLSTATE name in verbose error reports
Date: 2026-04-01 13:44:15
Message-ID: CAK3UJRGc2RKfQMjwVDAwsuOJuobq3d4+Qf9KWK1NHmK1vaqyxQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Attached is a patch implementing an old feature request on the wiki's Todo:

"Include the symbolic SQLSTATE name in verbose error reports"

The output should only be different in verbose mode, i.e. if you:

\set VERBOSITY verbose

The old output in verbose mode would look like:

# SELECT * FROM nonexistent_table;
ERROR: 42P01: relation "nonexistent_table" does not exist
LINE 1: SELECT * FROM nonexistent_table;

LOCATION: parserOpenTable, parse_relation.c:1461

The new output looks like:

# select * FROM nonexistent;
ERROR: 42P01 (ERRCODE_UNDEFINED_TABLE): relation "nonexistent" does not
exist
LINE 1: select * FROM nonexistent;
^
LOCATION: parserOpenTable, parse_relation.c:1461

so that we tell the user clearly what "42P01" means, in this example.

Cheers,
Josh

Attachment Content-Type Size
include-symbolic-SQLSTATE-name-in-verbose-mode-output.patch application/octet-stream 5.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-04-01 13:58:28 Re: 'Bad file descriptor: dup2( 1, 2 )' error on MacOS CI tasks
Previous Message Nazir Bilal Yavuz 2026-04-01 13:28:21 'Bad file descriptor: dup2( 1, 2 )' error on MacOS CI tasks