pgsql: Add a "SQLSTATE-only" error verbosity option to libpq and psql. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Add a "SQLSTATE-only" error verbosity option to libpq and psql.
Date
Msg-id E1hC9oI-0002ei-0P@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Add a "SQLSTATE-only" error verbosity option to libpq and psql.

This is intended for use mostly in test scripts for external tools,
which could do without cross-PG-version variations in error message
wording.  Of course, the SQLSTATE isn't guaranteed stable either, but
it should be more so than the error message text.

Note: there's a bit of an ABI change for libpq here, but it seems
OK because if somebody compiles against a newer version of libpq-fe.h,
and then tries to pass PQERRORS_SQLSTATE to PQsetErrorVerbosity()
of an older libpq library, it will be accepted and then act like
PQERRORS_DEFAULT, thanks to the way the tests in pqBuildErrorMessage3
have historically been phrased.  That seems acceptable.

Didier Gautheron, reviewed by Dagfinn Ilmari Mannsåker

Discussion: https://postgr.es/m/CAJRYxuKyj4zA+JGVrtx8OWAuBfE-_wN4sUMK4H49EuPed=mOBw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7bac3acab4d5c3f2c35aa3a7bea08411d83fd5bc

Modified Files
--------------
doc/src/sgml/libpq.sgml             | 45 ++++++++++++++++++++++++-------------
doc/src/sgml/ref/psql-ref.sgml      |  8 ++++---
src/bin/psql/help.c                 |  4 ++--
src/bin/psql/startup.c              |  8 ++++---
src/bin/psql/tab-complete.c         |  2 +-
src/interfaces/libpq/fe-protocol3.c | 18 +++++++++++++++
src/interfaces/libpq/libpq-fe.h     |  3 ++-
src/test/regress/expected/psql.out  | 20 +++++++++++++++++
src/test/regress/sql/psql.sql       | 15 +++++++++++++
9 files changed, 98 insertions(+), 25 deletions(-)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: pg_restore: Require "-f -" to mean stdout
Next
From: Andres Freund
Date:
Subject: pgsql: tableam: Add table_multi_insert() and revamp/speed-up COPYFROM