Add psql variables to track success/failure of SQL queries.

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

Commit: 69835bc8988812c960f4ed5aeee86b62ac73602a
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2017-09-12T23:27:48Z
Releases: 11.0
Add psql variables to track success/failure of SQL queries.

This patch adds ERROR, SQLSTATE, and ROW_COUNT, which are updated after
every query, as well as LAST_ERROR_MESSAGE and LAST_ERROR_SQLSTATE,
which are updated only when a query fails.  The expected usage of these
is for scripting.

Fabien Coelho, reviewed by Pavel Stehule

Discussion: https://postgr.es/m/alpine.DEB.2.20.1704042158020.12290@lancre

Files

PathChange+/−
doc/src/sgml/ref/psql-ref.sgml modified +44 −0
src/bin/psql/common.c modified +71 −0
src/bin/psql/help.c modified +10 −1
src/bin/psql/startup.c modified +4 −0
src/test/regress/expected/psql.out modified +131 −0
src/test/regress/sql/psql.sql modified +64 −0

Documentation touched

Discussion