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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add a "SQLSTATE-only" error verbosity option to libpq and psql.
Date: 2019-04-04 21:22:10
Message-ID: E1hC9oI-0002ei-0P@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2019-04-04 23:31:16 pgsql: tableam: Add table_multi_insert() and revamp/speed-up COPY FROM
Previous Message Alvaro Herrera 2019-04-04 19:55:36 pgsql: pg_restore: Require "-f -" to mean stdout