Re: [PATCH] psql: Display SQLSTATE macro name in verbose error reports

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: jian he <jian.universality@gmail.com>
Cc: Aaryan Parik <aaryanparik124@gmail.com>, pgsql-hackers@postgresql.org
Date: 2026-05-25T19:20:23Z
Lists: pgsql-hackers
jian he <jian.universality@gmail.com> writes:
> On Sun, May 24, 2026 at 3:18 AM Aaryan Parik <aaryanparik124@gmail.com> wrote:
>> Example output:
>> ERROR:  42601: syntax error at or near "FRO"
>> LINE 1: SELECT * FRO;
>> ^
>> LOCATION:  scanner_yyerror, scan.l:1220
>> SQLSTATE name: ERRCODE_SYNTAX_ERROR

> This seems identical to the patch submitted in the previous email thread, [0].

It's not exactly the same: Josh's patch did the dirty work in libpq
not psql.  So this has a somewhat smaller blast radius for client
compatibility problems (but still not zero).  The other comments
I posted in the other thread still apply though.

			regards, tom lane