Add a "SQLSTATE-only" error verbosity option to libpq and psql.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/libpq.sgml | modified | +30 −15 |
| doc/src/sgml/ref/psql-ref.sgml | modified | +5 −3 |
| src/bin/psql/help.c | modified | +2 −2 |
| src/bin/psql/startup.c | modified | +5 −3 |
| src/bin/psql/tab-complete.c | modified | +1 −1 |
| src/interfaces/libpq/fe-protocol3.c | modified | +18 −0 |
| src/interfaces/libpq/libpq-fe.h | modified | +2 −1 |
| src/test/regress/expected/psql.out | modified | +20 −0 |
| src/test/regress/sql/psql.sql | modified | +15 −0 |
Documentation touched
Discussion
- [proposal] Add an option for returning SQLSTATE in psql error message 25 messages · 2018-12-02 → 2019-04-04