Re: [proposal] Add an option for returning SQLSTATE in psql error message

Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: didier <did447@gmail.com>, Pavel Stěhule <pavel.stehule@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, andrew@tao11.riddles.org.uk, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-01-05T15:02:31Z
Lists: pgsql-hackers
On 04/12/2018 13:18, didier wrote:
> diff --git a/src/test/regress/sql/psql.sql b/src/test/regress/sql/psql.sql
> index 1bb2a6e16d..64628f29a3 100644
> --- a/src/test/regress/sql/psql.sql
> +++ b/src/test/regress/sql/psql.sql
> @@ -1016,3 +1016,22 @@ select 1/(15-unique2) from tenk1 order by unique2 limit 19;
>  \echo 'last error code:' :LAST_ERROR_SQLSTATE
>  
>  \unset FETCH_COUNT
> +
> +-- verbosity error setting
> +\set VERBOSITY terse
> +SELECT 1 UNION;
> +\echo 'error:' :ERROR
> +\echo 'error code:' :SQLSTATE
> +\echo 'last error message:' :LAST_ERROR_MESSAGE
> +
> +\set VERBOSITY sqlstate
> +SELECT 1 UNION;
> +\echo 'error:' :ERROR
> +\echo 'error code:' :SQLSTATE
> +\echo 'last error message:' :LAST_ERROR_MESSAGE
> +
> +\set VERBOSITY default
> +SELECT 1 UNION;
> +\echo 'error:' :ERROR
> +\echo 'error code:' :SQLSTATE
> +\echo 'last error message:' :LAST_ERROR_MESSAGE
> -- 

Why are you not including a test for \set VERBOSITY verbose?

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Commits

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